X-View - 一个基于 Virtual DOM 与 Web Components 的前端框架.

2015-06-24 20:36:02 +08:00
 IntPtr

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 支持正在开发中...

2461 次点击
所在节点    分享创造
2 条回复
visonme
2015-06-25 14:01:12 +08:00
为楼主赞一个,或许生产中不会使用到楼主的,但是应用中一些确实可以借鉴的
+1
jinzhe
2015-06-26 17:54:05 +08:00
感觉比原生还复杂

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/200904

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX