diff --git a/packages/omi/examples/base.tsx b/packages/omi/examples/base.tsx index 6d2cce2884..28cebc30a9 100644 --- a/packages/omi/examples/base.tsx +++ b/packages/omi/examples/base.tsx @@ -1,28 +1,80 @@ import { render, signal, tag, Component, h } from '@/index' -const count = signal(0) -function add() { - count.value++ + +@tag('aa-demo') +class AADemo extends Component { + static css = 'span { color: red; }' + + render() { + return ( + <> + + + + + ) + } } -function sub() { - count.value-- + +@tag('my-el') +class myel extends Component { + static css = 'span { color: red; }' + + render() { + return ( + <> + +
myel
+ + ) + } } -@tag('counter-demo') -class CounterDemo extends Component { +@tag('my-el2') +class myel2 extends Component { static css = 'span { color: red; }' render() { return ( <> - - {count.value} - + +
myel2
) } } -render(, document.body) \ No newline at end of file + + +@tag('my-app') +class CounterDemo extends Component { + static css = 'span { color: red; }' + tagName = 'div' + sub() { + + this.show = true + this.update() + } + + render() { + if (this.show) { + return ( + +

sfsdaf

+ this.sub()}>click me +
+ ) + } + return ( + + this.sub()}>click me!!! + + ) + } +} + + + +render(, document.body) \ No newline at end of file