https://github.com/lixiaoyan/x-view
一个有意义的轮子(伪), 三天写出来的产物, 仿 React 的 API.
一个 example:
var Button = x.createClass({ propTypes: { text: x.type.string }, render: function() { return x.createElement("button", { "on-click": this.emit.bind(this, "button-click") }, [this.props.text]); } }); x.register("x-button", Button); x.render(document.body, x.createElement("x-button", { text: "Hello!", "on-button-click": function() { console.log("You clicked the button."); } }));
目前还不稳定, 只是刚能用了而已, Shadow DOM 支持正在开发中...
![]() | 1 visonme 2015-06-25 14:01:12 +08:00 为楼主赞一个,或许生产中不会使用到楼主的,但是应用中一些确实可以借鉴的 +1 |
![]() | 2 jinzhe 2015-06-26 17:54:05 +08:00 感觉比原生还复杂 |