Go to file
dntzhang 985530a5bb update readme 2018-04-26 11:41:27 +08:00
.circleci ci 2017-10-31 16:28:04 +08:00
dist omi 1.8.0 2018-04-26 11:34:02 +08:00
docs update readme 2018-04-26 11:41:27 +08:00
example omi 1.8.0 2018-04-26 11:34:02 +08:00
plugins omix 2018-02-25 16:06:09 +08:00
repl Update index.html 2018-04-24 12:03:47 +08:00
src update readme 2018-04-26 11:26:56 +08:00
test fix circleci 2018-04-26 09:24:00 +08:00
tutorial omix 2018-02-25 16:06:09 +08:00
.eslintignore omix 2018-02-25 16:06:09 +08:00
.eslintrc omix 2018-02-25 16:06:09 +08:00
.gitignore omix 2018-02-25 16:06:09 +08:00
.travis.yml add travis.yml 2017-01-23 16:02:59 +08:00
README.md update readme 2018-04-26 11:41:27 +08:00
change-log.md update change-log.md 2018-04-26 11:35:34 +08:00
index.html omix 2018-02-25 16:20:24 +08:00
omi.rar omix 2018-02-25 16:05:31 +08:00
package.json add plugin example 2018-04-26 09:51:32 +08:00
webpack.config.js rename to omi 2018-04-26 09:19:34 +08:00

README.md

Omi

Open and modern framework for building user interfaces.

Build Status Version Download PRs

Features

  • Super fast, click here!!!!
  • Super tiny size, 7 KB (gzip)
  • Good compatibility, support IE8
  • 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

Hello Omi

class Hello extends Omi.Component {
    render() {
        return <div> Hello {this.data.name}!</div>
    }
}

class App extends Omi.Component {
    install() {
        this.name = 'Omi'
        this.handleClick = this.handleClick.bind(this)
    }

    handleClick(e) {
        this.name = 'Hello Omi' 
        this.update()
    }

    style() {
        return `h3{
	            color:red;
	            cursor: pointer;
	        }`
    }

    render() {
        return <div>
	            <Hello name={this.name}></Hello>
	            <h3 onclick={this.handleClick}>Scoped css and event test! click me!</h3>
	        </div>
    }
}

Omi.render(<App />, '#container')

Using Store System

class Store  {
    constructor(data, callbacks) {
        this.name = data.name || ''
        this.onRename = callbacks.onRename || function(){}
    }

    rename(name){
        this.name = name
        this.onRename()
    }
}


class Hello extends Omi.Component {
    render() {
        return (
            //you can also use this.$store.name here. but using data if this is a pure component.
            <div> Hello <span>{this.data.name}</span>!</div>
        )
    }
}

class App extends Omi.Component {

    install(){
        this.rename = this.rename.bind(this)
    }

    rename(){
        this.$store.rename('Hello Omi')
    }

    render() {
        return (
            <div onclick={this.rename}>
                <Hello name={this.$store.name}></Hello>
            </div>
        )
    }
}

let app = new App()
let store = new Store({ name : 'Omi' } ,{
    onRename :()=>{
        app.update()
    }
})

Omi.render(app, 'body',{
    store
})

→Try it online←

omi-cli

$ npm install omi-cli -g         # install cli
$ omi init your_project_name   # init project, you can also exec 'omi init' in an empty folder
$ cd your_project_name           # please ignore this command if you executed 'omi init' in an empty folder
$ npm start                      # develop
$ npm run dist                   # release

Install

npm install omi

or get it from CDN:

Plugins

License

This content is released under the MIT License.