mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-12 12:25:16 +08:00
81f4d2c070
* docs: Fix document errors for jsx * Update demo/pages/docs/jsx/enUS/index.md * Update demo/pages/docs/jsx/zhCN/index.md * docs: Optimization and modification scheme Co-authored-by: 谢宗辰 <xiezongchen@xiezongchendeMacBook-Pro.local> Co-authored-by: 07akioni <07akioni2@gmail.com>
31 lines
789 B
Markdown
31 lines
789 B
Markdown
<!--anchor:on-->
|
|
|
|
# JSX & TSX
|
|
|
|
## Enable JSX & TSX
|
|
|
|
About how to enable JSX & TSX please look at your toolchain's docs.
|
|
|
|
## Use Component
|
|
|
|
We recommend importing component directly when using JSX.
|
|
|
|
```js
|
|
import { defineComponent } from 'vue'
|
|
import { NButton } from 'naive-ui'
|
|
|
|
export default defineComponent({
|
|
render () {
|
|
return <NButton>{{ default: () => 'Star Kirby' }}</NButton>
|
|
}
|
|
})
|
|
```
|
|
|
|
## Props look like @update:\*
|
|
|
|
In naive-ui, all props look like `on-update:*` has a corresponding `onUpdate*` prop (since in JSX `on-update:*` and `onUpdate:*` are not valid prop names).
|
|
|
|
If you find it doesn't exist, I must forget to make it. Please create an issue or PR.
|
|
|
|
For example, `<n-select @update:value="..." />` in template can be written in `<NSelect onUpdateValue={...} />`.
|