我有這種控制用於加載SVG文檔(工程,SVG顯示細膩)處理與SVG控制事件在Enyo 2.0(對象或嵌入標籤)
enyo.kind({
name: "SvgParser",
kind:"Control",
fit: true,
published: {
source:''
},
components:[{
tag: "object", // Or Embed
name:'svgObject',
classes: 'SvgObject',
ontap:'click',
onload:'loaded'
}],
create: function() {
this.inherited(arguments);
this.sourceChanged();
},
click: function(inSender, inEvent) {
console.log('click'); // doesn't happen
},
sourceChanged: function() {
this.$.svgObject.attributes.type = 'image/svg+xml';
this.$.svgObject.attributes.data = this.source;
},
loaded: function(inSender, inEvent) {
console.log('loaded'); // doesn't happen
}
});
但事件處理程序「抽頭'和'負載'從未被觸發,有人可以解釋我做錯了什麼嗎?在此先感謝
完美答案!謝謝 –