mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-06 12:17:13 +08:00
docs(tree): fix tree demo
This commit is contained in:
parent
9618615ad2
commit
7c3fff1bfb
@ -12,7 +12,7 @@ Fortunately, the tree is now alive and it's not balanced.
|
||||
```
|
||||
|
||||
```js
|
||||
import { defineComponent } from 'vue'
|
||||
import { defineComponent, ref } from 'vue'
|
||||
|
||||
function createData (level = 4, baseKey = '') {
|
||||
if (!level) return undefined
|
||||
@ -37,7 +37,7 @@ export default defineComponent({
|
||||
setup () {
|
||||
return {
|
||||
data: createData(),
|
||||
defaultExpandedKeys: ['40', '41']
|
||||
defaultExpandedKeys: ref(['40', '41'])
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -13,7 +13,7 @@ Set `cascade` to use cascade check.
|
||||
```
|
||||
|
||||
```js
|
||||
import { defineComponent } from 'vue'
|
||||
import { defineComponent, ref } from 'vue'
|
||||
|
||||
function createData (level = 4, baseKey = '') {
|
||||
if (!level) return undefined
|
||||
@ -38,7 +38,7 @@ export default defineComponent({
|
||||
setup () {
|
||||
return {
|
||||
data: createData(),
|
||||
defaultExpandedKeys: ['40', '41']
|
||||
defaultExpandedKeys: ref(['40', '41'])
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -10,7 +10,7 @@ Tree accept `pattern` and `filter` to do searching.
|
||||
```
|
||||
|
||||
```js
|
||||
import { defineComponent } from 'vue'
|
||||
import { defineComponent, ref } from 'vue'
|
||||
|
||||
function createData (level = 4, baseKey = '') {
|
||||
if (!level) return undefined
|
||||
@ -35,7 +35,7 @@ export default defineComponent({
|
||||
setup () {
|
||||
return {
|
||||
data: createData(),
|
||||
pattern: ''
|
||||
pattern: ref('')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -9,7 +9,7 @@ Set `multiple` to select multiple nodes.
|
||||
```
|
||||
|
||||
```js
|
||||
import { defineComponent } from 'vue'
|
||||
import { defineComponent, ref } from 'vue'
|
||||
|
||||
function createData (level = 4, baseKey = '') {
|
||||
if (!level) return undefined
|
||||
@ -34,7 +34,7 @@ export default defineComponent({
|
||||
setup () {
|
||||
return {
|
||||
data: createData(),
|
||||
value: []
|
||||
value: ref([])
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -12,7 +12,7 @@ Add some actions.
|
||||
```
|
||||
|
||||
```js
|
||||
import { h, defineComponent } from 'vue'
|
||||
import { h, defineComponent, ref } from 'vue'
|
||||
import { NButton } from 'naive-ui'
|
||||
|
||||
function createData (level = 4, baseKey = '') {
|
||||
@ -47,7 +47,7 @@ export default defineComponent({
|
||||
setup () {
|
||||
return {
|
||||
data: createData(),
|
||||
defaultExpandedKeys: ['40', '41']
|
||||
defaultExpandedKeys: ref(['40', '41'])
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -12,7 +12,7 @@
|
||||
```
|
||||
|
||||
```js
|
||||
import { defineComponent } from 'vue'
|
||||
import { defineComponent, ref } from 'vue'
|
||||
|
||||
function createData (level = 4, baseKey = '') {
|
||||
if (!level) return undefined
|
||||
@ -37,7 +37,7 @@ export default defineComponent({
|
||||
setup () {
|
||||
return {
|
||||
data: createData(),
|
||||
defaultExpandedKeys: ['40', '41']
|
||||
defaultExpandedKeys: ref(['40', '41'])
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -13,7 +13,7 @@
|
||||
```
|
||||
|
||||
```js
|
||||
import { defineComponent } from 'vue'
|
||||
import { defineComponent, ref } from 'vue'
|
||||
|
||||
function createData (level = 4, baseKey = '') {
|
||||
if (!level) return undefined
|
||||
@ -38,7 +38,7 @@ export default defineComponent({
|
||||
setup () {
|
||||
return {
|
||||
data: createData(),
|
||||
defaultExpandedKeys: ['40', '41']
|
||||
defaultExpandedKeys: ref(['40', '41'])
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -10,7 +10,7 @@
|
||||
```
|
||||
|
||||
```js
|
||||
import { defineComponent } from 'vue'
|
||||
import { defineComponent, ref } from 'vue'
|
||||
|
||||
function createData (level = 4, baseKey = '') {
|
||||
if (!level) return undefined
|
||||
@ -34,7 +34,7 @@ export default defineComponent({
|
||||
setup () {
|
||||
return {
|
||||
data: createData(),
|
||||
pattern: ''
|
||||
pattern: ref('')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -9,7 +9,7 @@
|
||||
```
|
||||
|
||||
```js
|
||||
import { defineComponent } from 'vue'
|
||||
import { defineComponent, ref } from 'vue'
|
||||
|
||||
function createData (level = 4, baseKey = '') {
|
||||
if (!level) return undefined
|
||||
@ -34,7 +34,7 @@ export default defineComponent({
|
||||
setup () {
|
||||
return {
|
||||
data: createData(),
|
||||
value: []
|
||||
value: ref([])
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -12,7 +12,7 @@
|
||||
```
|
||||
|
||||
```js
|
||||
import { h, defineComponent } from 'vue'
|
||||
import { h, defineComponent, ref } from 'vue'
|
||||
import { NButton } from 'naive-ui'
|
||||
|
||||
function createData (level = 4, baseKey = '') {
|
||||
@ -47,7 +47,7 @@ export default defineComponent({
|
||||
setup () {
|
||||
return {
|
||||
data: createData(),
|
||||
defaultExpandedKeys: ['40', '41']
|
||||
defaultExpandedKeys: ref(['40', '41'])
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user