Omi Versions Save

Web Components Framework - Web组件框架

v7.6.6

1 month ago

v7.5.6

3 months ago

v7.5.0

3 months ago
function ChildComponent(props) {
  return (
    <span>{props.msg}</span>
  )
}

class ParentComponent extends Component {
  render() {
    return (
      <div>
        <ChildComponent msg="omi" />
      </div>
    )
  }
}

v7.4.5

3 months ago
import { tag, Component, h, bind } from 'omi'

@tag('my-counter')
class MyCounter extends Component {
  static props = {
    count: {
      type: Number,
      default: 0,
      changed(newValue, oldValue) {
        this.state.count = newValue
        this.update()
      }
    }
  }

  state = {
    count: null
  }

  install() {
    this.state.count = this.props.count
  }

  @bind
  sub() {
    this.state.count--
    this.update()
    this.fire('change', this.state.count)
  }

  @bind
  add() {
    this.state.count++
    this.update()
    this.fire('change', this.state.count)
  }

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

v7.4.1

3 months ago
import { Button } from './button' 

class MyApp extends Component {
  render() {
    return (
      <Button>test</Button>
    )
  }
}

v7.3.10

4 months ago

v7.3.9

4 months ago

If we are writing a component library and need to use tree shaking capabilities,

import { WeButton } from 'ui-lib' 

It could lead to definition failure if Button is not used, as it would be tree-shaken away. Therefore, we need to use Button, for example,

WeButton.define('we-button')

v7.3.8

4 months ago

v7.3.6

5 months ago