docs(config-provider): 完善文档中的用例 (#861)

This commit is contained in:
songjianet 2021-08-13 21:52:00 +08:00 committed by GitHub
parent 1abb00b15d
commit 1cf249cbe7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 32 additions and 29 deletions

View File

@ -13,10 +13,10 @@
```
```js
import { ref } from 'vue'
import { defineComponent, ref } from 'vue'
import { zhCN, dateZhCN } from 'naive-ui'
export default {
export default defineComponent({
setup () {
return {
zhCN,
@ -25,5 +25,5 @@ export default {
dateLocale: ref(null)
}
}
}
})
```

View File

@ -16,12 +16,14 @@ Some parts of component are detached to `document.body`. If you want to add a cl
```
```js
export default {
data () {
import { defineComponent, ref } from 'vue'
export default defineComponent({
setup () {
return {
ns: 'custom-app-namespace1',
isActive: false
ns: ref('custom-app-namespace1'),
isActive: ref(false)
}
}
}
})
```

View File

@ -9,10 +9,10 @@ Naive UI provides `useOsTheme` to get the current theme of your OS.
```
```js
import { computed } from 'vue'
import { defineComponent, computed } from 'vue'
import { useOsTheme, darkTheme } from 'naive-ui'
export default {
export default defineComponent({
setup () {
const osThemeRef = useOsTheme()
return {
@ -20,5 +20,5 @@ export default {
osTheme: osThemeRef
}
}
}
})
```

View File

@ -14,15 +14,15 @@ Set theme of inner components of `n-config-provider`.
```
```js
import { ref } from 'vue'
import { defineComponent, ref } from 'vue'
import { darkTheme } from 'naive-ui'
export default {
export default defineComponent({
setup () {
return {
darkTheme,
theme: ref(null)
}
}
}
})
```

View File

@ -13,7 +13,6 @@ inherit-theme
os-theme
language
transparent
overrides-inherit-debug
```
## Props

View File

@ -13,10 +13,10 @@
```
```js
import { ref } from 'vue'
import { defineComponent, ref } from 'vue'
import { zhCN, dateZhCN } from 'naive-ui'
export default {
export default defineComponent({
setup () {
return {
zhCN,
@ -25,5 +25,5 @@ export default {
dateLocale: ref(null)
}
}
}
})
```

View File

@ -14,12 +14,14 @@
```
```js
export default {
data () {
import { defineComponent, ref } from 'vue'
export default defineComponent({
setup () {
return {
ns: 'custom-app-namespace1',
isActive: false
ns: ref('custom-app-namespace1'),
isActive: ref(false)
}
}
}
})
```

View File

@ -9,10 +9,10 @@ Naive UI 提供 `useOsTheme` 来获取当前操作系统的主题。
```
```js
import { computed } from 'vue'
import { defineComponent, computed } from 'vue'
import { useOsTheme, darkTheme } from 'naive-ui'
export default {
export default defineComponent({
setup () {
const osThemeRef = useOsTheme()
return {
@ -20,5 +20,5 @@ export default {
osTheme: osThemeRef
}
}
}
})
```

View File

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