docs(theme): Upgrade the use case of theme to Composition API (#1131)

This commit is contained in:
songjianet 2021-09-08 14:33:27 +08:00 committed by GitHub
parent 1e2ca008ff
commit 336fcf98c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 12 deletions

View File

@ -22,15 +22,15 @@ Naive UI has `n-element` component. See [Element](../components/element).
``` ```
```js ```js
import { ref } from 'vue' import { defineComponent, ref } from 'vue'
import { darkTheme } from 'naive-ui' import { darkTheme } from 'naive-ui'
export default { export default defineComponent({
setup () { setup () {
return { return {
darkTheme, darkTheme,
theme: ref(null) theme: ref(null)
} }
} }
} })
``` ```

View File

@ -14,15 +14,15 @@ Use `n-config-provider` to set the theme of all its descedant components.
``` ```
```js ```js
import { ref } from 'vue' import { defineComponent, ref } from 'vue'
import { darkTheme } from 'naive-ui' import { darkTheme } from 'naive-ui'
export default { export default defineComponent({
setup () { setup () {
return { return {
darkTheme, darkTheme,
theme: ref(null) theme: ref(null)
} }
} }
} })
``` ```

View File

@ -22,15 +22,15 @@ Naive UI 提供 `n-element` 组件,参考 [Element](../components/element)。
``` ```
```js ```js
import { ref } from 'vue' import { defineComponent, ref } from 'vue'
import { darkTheme } from 'naive-ui' import { darkTheme } from 'naive-ui'
export default { export default defineComponent({
setup () { setup () {
return { return {
darkTheme, darkTheme,
theme: ref(null) theme: ref(null)
} }
} }
} })
``` ```

View File

@ -14,15 +14,15 @@
``` ```
```js ```js
import { ref } from 'vue' import { defineComponent, ref } from 'vue'
import { darkTheme } from 'naive-ui' import { darkTheme } from 'naive-ui'
export default { export default defineComponent({
setup () { setup () {
return { return {
darkTheme, darkTheme,
theme: ref(null) theme: ref(null)
} }
} }
} })
``` ```