提供了es6,es6,typescript三个分支到javascript插件开发模板
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

44 lines
1.5 KiB

// 建议每个文件都包裹一层立即执行函数,避免插件的全局变量污染
!(function () {
var Widget = BI.inherit(BI.BasicButton, {
props: {
baseCls: "decision-plugin-demo",
},
render: function () {
var self = this, o = this.options;
return {
type: "bi.vertical",
hgap: 10,
vgap: 10,
items: [
{
el: {
type: "bi.vertical_adapt",
rgap: 10,
items: [
{
type: "bi.label",
text: "测试开关"
}, {
type: "bi.switch",
ref: function (_ref) {
self.switchButton = _ref;
},
selected: false,
handler: function () {
console.log(self.switchButton.isSelected() ? "开启" : "关闭")
}
}
]
},
},
],
};
},
});
BI.shortcut("dec.plugin.demo", Widget);
}());