omi/packages/omii
dntzhang ec43c33e17 rename 2019-02-19 14:56:59 +08:00
..
config rename 2019-02-19 14:56:59 +08:00
examples rename 2019-02-19 14:56:59 +08:00
src rename 2019-02-19 14:56:59 +08:00
test rename 2019-02-19 14:56:59 +08:00
.babelrc rename 2019-02-19 14:56:59 +08:00
.editorconfig rename 2019-02-19 14:56:59 +08:00
.eslintignore rename 2019-02-19 14:56:59 +08:00
.eslintrc rename 2019-02-19 14:56:59 +08:00
.flowconfig rename 2019-02-19 14:56:59 +08:00
.gitignore rename 2019-02-19 14:56:59 +08:00
CocktailDemo.js rename 2019-02-19 14:56:59 +08:00
README.md rename 2019-02-19 14:56:59 +08:00
cax.js rename 2019-02-19 14:56:59 +08:00
cocktail.html rename 2019-02-19 14:56:59 +08:00
css2json.html rename 2019-02-19 14:56:59 +08:00
index.html rename 2019-02-19 14:56:59 +08:00
package.json rename 2019-02-19 14:56:59 +08:00

README.md

omix

Omi 小程序组件框架。

my-counter

index.js

import { render, WeElement, define } from 'omix'

define('my-counter', class extends WeElement {
  count = 1

  sub = () => {
    this.count--
    this.update()
  }

  add = () => {
    this.count++
    this.update()
  }

  buttonStyle = {
    color: 'red'
  }

  testStyle = {
    backgroundColor: 'red'
  }

  render() {
    return (
      <div>
        <button style={this.buttonStyle} onClick={this.sub}>-</button>
        <span style={this.testStyle}>{this.count}</span>
        <button style={this.buttonStyle} onClick={this.add}>+</button>
      </div>
    )
  }
})

render(<my-counter />, 'body')