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.
57 lines
1.5 KiB
57 lines
1.5 KiB
4 years ago
|
<html>
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<title></title>
|
||
|
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css"/>
|
||
|
<!-- 下面是不包含normalize.css的css -->
|
||
|
<!-- <link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui_without_normalize.min.css" /> -->
|
||
|
<script src="./dist/fineui.js"></script>
|
||
|
<script src="./dist/fix/worker.compact.js"></script>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div id="wrapper"></div>
|
||
|
<script>
|
||
|
var worker = new Worker("./demo.worker.js");
|
||
|
|
||
|
BI.useWorker(worker);
|
||
|
|
||
|
var Widget = BI.inherit(BI.Widget, {
|
||
|
_worker: function () {
|
||
|
return "demo.model";
|
||
|
},
|
||
|
watch: {
|
||
|
name: function (val) {
|
||
|
this.button.setText(val);
|
||
|
}
|
||
|
},
|
||
|
render: function () {
|
||
|
var self = this;
|
||
|
console.log(this.model);
|
||
|
return {
|
||
|
type: "bi.button",
|
||
|
ref: function (_ref) {
|
||
|
self.button = _ref;
|
||
|
},
|
||
|
text: this.model.name,
|
||
|
handler: function () {
|
||
|
self.store.addCount();
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
});
|
||
|
BI.shortcut("demo.worker", Widget);
|
||
|
BI.createWidget({
|
||
|
type: "bi.absolute",
|
||
|
items: [{
|
||
|
el: {
|
||
|
type: "demo.worker"
|
||
|
},
|
||
|
top: 100,
|
||
|
left: 100
|
||
|
}],
|
||
|
element: "#wrapper"
|
||
|
});
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|