Browse Source

生命周期mount,先把子dom节点创建完再整个一起append到父节点上去

es6
guy 4 years ago
parent
commit
3bc1eb890d
  1. 23
      dev.html

23
dev.html

@ -70,26 +70,24 @@
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);
return function () { return function () {
return { return {
type: "bi.vertical", type: "bi.vertical",
vgap: 20, vgap: 20,
items: BI.makeArray(10000).map(function (i) { items: [{
return { type: "demo.child"
type: "bi.label", }, {
text: i type: "demo.child"
}; }]
})
}; };
}; };
} }
}); });
BI.shortcut("demo.parent", Widget); BI.shortcut("demo.parent", Widget);
var time = performance.now(); BI.createWidget({
var widget = BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
items: [{ items: [{
el: { el: {
@ -99,10 +97,7 @@
left: 100 left: 100
}], }],
element: "#wrapper" element: "#wrapper"
// root: true
}); });
// widget.element.appendTo("#wrapper");
console.log(performance.now() - time);
</script> </script>
</body> </body>
</html> </html>

Loading…
Cancel
Save