Go to file
kmdjs 2aff690cb6 add svg demo 2017-02-21 21:11:50 +08:00
asset html2json for omi 2017-02-18 12:47:00 +08:00
dist omi v.0.3.3 - clean up data system 2017-02-20 10:10:42 +08:00
docs Translate en_events.md 2017-02-20 21:12:39 +08:00
example add svg demo 2017-02-21 21:11:50 +08:00
plugins update date picker plugin 2017-02-16 10:27:36 +08:00
scaffolding update docs 2017-02-20 17:25:11 +08:00
src omi v.0.3.3 - clean up data system 2017-02-20 10:10:42 +08:00
test fix ci build error 2017-02-19 12:55:50 +08:00
website Translate en_events.md 2017-02-20 21:12:39 +08:00
.gitignore Omi 2017-01-21 14:01:46 +08:00
.travis.yml add travis.yml 2017-01-23 16:02:59 +08:00
README.md update docs 2017-02-21 09:44:41 +08:00
index.html update finger demo 2017-02-13 08:55:19 +08:00
package.json add svg demo 2017-02-21 21:11:50 +08:00
webpack.config.js omi v.0.3.3 - clean up data system 2017-02-20 10:10:42 +08:00

README.md

Omi

Open and modern framework for building user interfaces.


中文 | English

Omi

特性

  • 超小的尺寸7 kb (gzip)
  • 良好的兼容性支持IE8
  • 完全面向对象的组件体系
  • 局部CSSHTML+ Scoped CSS + JS组成可复用的组件
  • 更自由的更新每个组件都有update方法自由选择时机进行更新
  • 模板引擎可替换开发者可以重写Omi.template方法来使用任意模板引擎
  • 提供了ES6+和ES5的两种开发方案供开发者自由选择

生态

通过npm安装

npm install omi

Hello World

class Hello extends Omi.Component {
    constructor(data) {
        super(data);
    }
    style () {
        return  `
            h1{
                cursor:pointer;
            }
         `;
    }
    handleClick(target, evt){
        alert(target.innerHTML);
    }
    render() {
        return  `
        <div>
            <h1 onclick="handleClick(this, event)">Hello ,{{name}}!</h1>
        </div>
        `;

    }
}

Omi.render(new Hello({ name : "Omi" }),"body");

[点击这里->在线试试]

如果使用omi.lite.js版本(不包含mustachejs模板引擎)的话,也可以使用 ${this.data.name} 的方式

你可以使用Omi.makeHTML来生成组件标签用于嵌套。

    Omi.makeHTML('Hello', Hello);

那么你就在其他组件中使用并且通过data-*的方式可以给组件传参,如:

  ...
  render() {
        return  `
        <div>
            <div>Test</div>
            <Hello data-name="Omi" />
        </div>
        `;
    }
    ...

[点击这里->在线试试]

你可以使用 webpack + babel在webpack配置的module设置babel-loader立马就能使用ES6+来编写你的web程序。

当然Omi没有抛弃ES5的用户你可以使用ES5的方式编写Omi。[点击这里试试ES5写Omi程序]

中文 | English

  • If you want to experience the Omi framework, please click Omi Playground
  • If you want to use the Omi framework,please read the Omi documentation
  • If you want to develop and improve the Omi framework, there are better solutions or ideas, please read develop the Omi framework step by step
  • If you want to get a better reading experience of the above two categories of documents, you can visitDocs Website
  • If you are too lazy to build a project scaffolding, you can try Scaffolding for Omi
  • If you have Any problemsplease New issue
  • If you want to be more convenient on the exchange of all Omi can join the QQ Omi exchange group (256426170)

Fetures

  • Super tiny size, 7 KB (gzip)
  • Good compatibility, support IE8
  • Fully object-oriented component system
  • Support Scoped CSS, reusable components are composed of HTML Scoped CSS and JS
  • More free updates, each component has a update method, free to choose the right time to update
  • Template engines can be replaced, developers can override the Omi.template method to use any template engine
  • Provides two development way ( ES6+ and ES5) for developers to choose freely

Plugins

Install

npm install omi

Hello World

class Hello extends Omi.Component {
    constructor(data) {
        super(data);
    }
    style () {
        return  `
            h1{
                cursor:pointer;
            }
         `;
    }
    handleClick(target, evt){
        alert(target.innerHTML);
    }
    render() {
        return  `
        <div>
            <h1 onclick="handleClick(this, event)">Hello ,{{name}}!</h1>
        </div>
        `;

    }
}

Omi.render(new Hello({ name : "Omi" }),"body");

[Try it on Playground]

You can use Omi.makeHTML to generate component tags for nesting.

    Omi.makeHTML('Hello', Hello);

Then you can use it in other components, and pass parameter to the component through the data-* , such as:

  ...
  render() {
        return  `
        <div>
            <div>Test</div>
            <Hello data-name="Omi" />
        </div>
        `;
    }
    ...

[Try it on Playground]

You can use webpack + babelconfigure the babel-loader in the module settings of webpackthen you can use ES6+ to write your web program.

Omi did not abandon the ES5 users, you can also use ES5 to write Omi.[Try Omi-ES5 on Playground]

Contributors

name avatars company
xcatliu Microsoft
Aresn TalkingCoder
pasturn Mars Holding
dntzhang Tencent

License

This content is released under the MIT License.