Releases: Tencent/omi
Releases · Tencent/omi
Fix inner fragment tag render error
import { define, h } from '../../src/omi'
define('my-component', _ => {
return h('svg', null,
h(h.f, null,
h("circle", {
cx: "18",
cy: "4.54",
r: "2"
}),
h("path", {
d: "M15 17h-2c0 1.65-1.35 3-3 3s-3-1.35-3-3 1.35-3 3-3v-2c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5zm3-3.5h-1.86l1.67-3.67C18.42 8.5 17.44 7 15.96 7h-5.2c-.81 0-1.54.47-1.87 1.2L8.22 10l1.92.53.65-1.53H13l-1.83 4.1c-.6 1.33.39 2.9 1.85 2.9H18v5h2v-5.5c0-1.1-.9-2-2-2z"
})))
})
Fix render null error when first time rendering
v6.17.1 chore: update dependencies of o-table
Support use prop and useSelf prop
import { render, define, h } from 'omi'
const store = {
data: {
count: 1
}
}
store.sub = () => {
store.data.count--
}
store.add = () => {
store.data.count++
}
define('my-counter', _ => (
<h.f>
<button onClick={_.store.sub}>-</button>
<span>{_.store.data.count}</span>
<button onClick={_.store.add}>+</button>
</h.f>
))
define('my-app', _ => (
<div>
<my-counter use={['count']} ></my-counter>
</div>
))
render(<my-app />, 'body', store)
Compute and Computed
You can implement computed
props through compute
, such as:
define('my-counter', _ => (
<div>
<button onClick={_.store.sub}>-</button>
<span>{_.store.data.count}</span>
<button onClick={_.store.add}>+</button>
<div>Double: {_.computed.doubleCount}</div>
</div>
), {
use: ['count'],
compute: {
doubleCount() {
return this.count * 2
}
}
})