slot demo
This commit is contained in:
parent
d39e54cf05
commit
910eb536c6
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,7 @@
|
|||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
|
||||
<script src="b.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,27 @@
|
|||
import { tag, render, WeElement } from '../../src/omi'
|
||||
|
||||
@tag('hello-element')
|
||||
class HelloElement extends WeElement {
|
||||
render() {
|
||||
return (
|
||||
<div onClick={this.onClick}>
|
||||
<p><slot name="my-text">My default text</slot></p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@tag('my-app')
|
||||
class MyApp extends WeElement {
|
||||
render() {
|
||||
return (
|
||||
<div >
|
||||
<hello-element>
|
||||
<span slot="my-text">Let's have some different text!</span>
|
||||
</hello-element>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
render(<my-app></my-app>, 'body')
|
|
@ -14,6 +14,7 @@
|
|||
"copy-typescript-definition": "copyfiles -f src/omi.d.ts dist",
|
||||
"build": "npm-run-all --silent clean transpile copy-flow-definition copy-typescript-definition strip optimize minify size",
|
||||
"flow": "flow",
|
||||
"slot": "rollup -c config/rollup.example.js --watch",
|
||||
"decorators": "rollup -c config/rollup.example.js --watch",
|
||||
"todo-app": "rollup -c config/rollup.example.js --watch",
|
||||
"store": "rollup -c config/rollup.example.js --watch",
|
||||
|
|
Loading…
Reference in New Issue