我有这个用于加载 SVG 文档的控件(有效,SVG 显示正常)
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
}
});
但是'tap'和'load'的事件处理程序永远不会被触发,有人可以解释我做错了什么吗?提前致谢