Skip to content

v6.8.0

Compare
Choose a tag to compare
@dntzhang dntzhang released this 28 Jul 02:10
· 438 commits to master since this release

New syntax, prop supports reading prop from data center - Omi.$

Example

Define element:

import { define, WeElement } from 'omi'

define('my-ele', class extends WeElement {
  static propTypes = {
    user: Object
  }

  render(props) {
    return (
      <div>name: {props.user.name}, age: {props.user.age}</div>
    )
  }
})

Using Element in others framework or pure js:

<script>
  Omi.$.user = { name: 'dntzhang', age: 18 }
</script>
<my-ele user=":user" ></my-ele>

Also supports path:

<other-ele age=":user.age" ></other-ele>