Browse Source

增加组件默认populate方法

es6
guy 4 years ago
parent
commit
1ee7637083
  1. 2
      examples/demo.worker.js
  2. 15
      examples/dev.html
  3. 4
      examples/hooks.html
  4. 8
      examples/worker.html
  5. 4
      src/base/single/button/buttons/button.js
  6. 4
      src/base/single/label/abstract.label.js
  7. 4
      src/base/single/single.js

2
demo.worker.js → examples/demo.worker.js

@ -1,5 +1,5 @@
if (this.importScripts) { if (this.importScripts) {
importScripts("./dist/fineui_without_jquery_polyfill.js"); importScripts("../dist/fineui_without_jquery_polyfill.js");
BI.initWorker(); BI.initWorker();
} }
var Model = BI.inherit(Fix.Model, { var Model = BI.inherit(Fix.Model, {

15
dev.html → examples/dev.html

@ -2,7 +2,8 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title></title> <title></title>
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css"/> <link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/>
<!-- <script src="../dist/2.0/fineui.js"></script>-->
<script src="http://localhost:9001/fineui.js"></script> <script src="http://localhost:9001/fineui.js"></script>
</head> </head>
<body> <body>
@ -37,9 +38,6 @@
BI.model("demo.child_model", ChildModel); BI.model("demo.child_model", ChildModel);
var Child = BI.inherit(BI.Widget, { var Child = BI.inherit(BI.Widget, {
props: {
updateMode: "auto"
},
setup: function () { setup: function () {
var store = BI.useStore(function () { var store = BI.useStore(function () {
return BI.Models.getModel("demo.child_model"); return BI.Models.getModel("demo.child_model");
@ -67,18 +65,25 @@
updateMode: "auto" updateMode: "auto"
}, },
setup: function () { setup: function () {
var child;
var store = BI.useStore(function () { var store = BI.useStore(function () {
return BI.Models.getModel("demo.model"); return BI.Models.getModel("demo.model");
}); });
setInterval(function () { setInterval(function () {
store.toggle(); store.toggle();
}, 1000); }, 1000);
BI.watch("text", function () {
child.populate();
});
return function () { return function () {
return { return {
type: "bi.vertical", type: "bi.vertical",
vgap: 20, vgap: 20,
items: [{ items: [{
type: "demo.child" type: "demo.child",
ref: function (_ref) {
child = _ref;
}
}, { }, {
type: "demo.child" type: "demo.child"
}] }]

4
hooks.html → examples/hooks.html

@ -2,8 +2,8 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title></title> <title></title>
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css"/> <link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/>
<script src="./dist/fineui.js"></script> <script src="../dist/2.0/fineui.js"></script>
</head> </head>
<body> <body>
<div id="wrapper"></div> <div id="wrapper"></div>

8
worker.html → examples/worker.html

@ -2,11 +2,9 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title></title> <title></title>
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css"/> <link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.css"/>
<!-- 下面是不包含normalize.css的css --> <script src="../dist/2.0/fineui.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui_without_normalize.min.css" /> --> <script src="../dist/fix/worker.compact.js"></script>
<script src="./dist/fineui.js"></script>
<script src="./dist/fix/worker.compact.js"></script>
<script src="demo.worker.js"></script> <script src="demo.worker.js"></script>
</head> </head>
<body> <body>

4
src/base/single/button/buttons/button.js

@ -145,10 +145,6 @@ BI.Button = BI.inherit(BI.BasicButton, {
unHighLight: function () { unHighLight: function () {
this.text.unHighLight.apply(this.text, arguments); this.text.unHighLight.apply(this.text, arguments);
},
destroy: function () {
BI.Button.superclass.destroy.apply(this, arguments);
} }
}); });
BI.shortcut("bi.button", BI.Button); BI.shortcut("bi.button", BI.Button);

4
src/base/single/label/abstract.label.js

@ -381,10 +381,6 @@
if (!this.isReadOnly()) { if (!this.isReadOnly()) {
this.text.setValue(v); this.text.setValue(v);
} }
},
populate: function () {
BI.AbstractLabel.superclass.populate.apply(this, arguments);
} }
}); });
}()); }());

4
src/base/single/single.js

@ -138,10 +138,6 @@ BI.Single = BI.inherit(BI.Widget, {
this._hoverBinded = false; this._hoverBinded = false;
}, },
populate: function (items) {
this.items = items || [];
},
// opt: {container: '', belowMouse: false} // opt: {container: '', belowMouse: false}
setTitle: function (title, opt) { setTitle: function (title, opt) {
this.options.title = title; this.options.title = title;

Loading…
Cancel
Save