Skip to content

CSS Prop Supported 🎉 !

Compare
Choose a tag to compare
@dntzhang dntzhang released this 19 Oct 04:38
· 447 commits to master since this release

Usage

@tag('counter-demo')
class CounterDemo extends Component {
  static css = 'span { color: red; }'

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

@tag('my-app')
class MyApp extends Component {

  cssProp: string = ''

  installed(): void {
    setInterval(() => {
      this.cssProp = `span{ font-size: ${Math.floor(Math.random() * 120)}px }`
      this.update()
    }, 500)

  }
  render() {
    return (
      <counter-demo css={this.cssProp || 'span{ color: green !important}'} />
    )
  }
}

企业微信截图_3f6d7888-2bac-4371-abe1-8552a1838538