我想在我的自定义视图类中使用Sencha的Ext.draw.Component绘制一个圆圈,但它没有显示任何圆圈。我已粘贴代码以供参考。
我还试图在我的Main类中定义类型组件的变量,但是在这样做时,编译器给出了一个错误,指出类型组件是未知的。
//主类
Ext.define('GS0.view.Main', {
extend: 'Ext.tab.Panel',
xtype: 'main',
requires: [
'Ext.TitleBar',
'Ext.Video',
'Ext.Carousel',
'Ext.Container',
'Ext.draw.Component',
'Ext.Img'
],
config: {
tabBarPosition: 'bottom',
items: [
{
iconCls: 'home',
xtype: 'carousel',
ui : 'dark',
direction: 'horizontal',
items: [
{
xtype: 'draw',
type: 'circle',
radius: 50,
x: 100,
y: 100,
fill: '#2d2d2d'
},
{
xtype: 'img',
src: 'images/nm.jpg'
}
]
}
]
}
});
// Circle Class
Ext.define('GS0.view.CC', {
extend: 'Ext.draw.Component',
xtype: 'cc',
config: {
type: 'circle',
cx: 100,
cy: 100,
r: 25,
fillStyle: 'blue'
}
});
答案 0 :(得分:0)
尝试修改GSO.view.Main
中的项目items: [{
iconCls: 'home',
xtype: 'carousel',
ui : 'dark',
direction: 'horizontal',
items: [{
xtype: 'draw',
items:[{
type: 'circle',
fill: '#79BB3F',
radius: 100,
x: 100,
y: 100
}]
},{
xtype: 'img',
src: 'images/nm.jpg'
}]
}]
圆形代码应作为项添加到xtype = draw块。
答案 1 :(得分:0)
我认为我加载Main的方式是个问题。这是代码。你能发现任何错误吗? PS请参阅Ext.viewport.add行(Ext.create(GS0.view.main))
Ext.Loader.setPath({
'Ext': 'touch/src',
'GS0': 'app'
});
//</debug>
Ext.application({
name: 'GS0',
requires: [
'Ext.MessageBox'
],
views: [
'Main'
],
icon: {
'57': 'resources/icons/Icon.png',
'72': 'resources/icons/Icon~ipad.png',
'114': 'resources/icons/Icon@2x.png',
'144': 'resources/icons/Icon~ipad@2x.png'
},
isIconPrecomposed: true,
startupImage: {
'320x460': 'resources/startup/320x460.jpg',
'640x920': 'resources/startup/640x920.png',
'768x1004': 'resources/startup/768x1004.png',
'748x1024': 'resources/startup/748x1024.png',
'1536x2008': 'resources/startup/1536x2008.png',
'1496x2048': 'resources/startup/1496x2048.png'
},
launch: function() {
// Destroy the #appLoadingIndicator element
Ext.fly('appLoadingIndicator').destroy();
// Initialize the main view
Ext.Viewport.add(Ext.create('GS0.view.Main'));
},
onUpdated: function() {
Ext.Msg.confirm(
"Application Update",
"This application has just successfully been updated to the latest version. Reload now?",
function(buttonId) {
if (buttonId === 'yes') {
window.location.reload();
}
}
);
}
});