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>