forked from tusen-ai/naive-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
214 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Large Data | ||
|
||
Large data is ok. By default `virtual-scroll` is true, so the demo only wants to show you cascader work with large data. | ||
|
||
In the example there are 5000 _ 2 _ 2 = 20000 entries. | ||
|
||
```html | ||
<n-space vertical> | ||
<n-space> | ||
<n-space><n-switch v-model:value="leafOnly" />Leaf Only</n-space> | ||
<n-space><n-switch v-model:value="cascade" />Cascade</n-space> | ||
<n-space><n-switch v-model:value="showPath" />Show Path</n-space> | ||
<n-space><n-switch v-model:value="hoverTrigger" />Hover Trigger</n-space> | ||
<n-space><n-switch v-model:value="filterable" />Filterable</n-space> | ||
</n-space> | ||
<n-cascader | ||
v-model:value="value" | ||
placeholder="Useless Value" | ||
:expand-trigger="hoverTrigger ? 'hover' : 'click'" | ||
:options="options" | ||
:cascade="cascade" | ||
:leaf-only="leafOnly" | ||
:show-path="showPath" | ||
:filterable="filterable" | ||
/> | ||
</n-space> | ||
``` | ||
|
||
```js | ||
function genOptions (depth = 3, iterator = 1, prefix = '') { | ||
const length = iterator === 1 ? 5000 : 2 | ||
const options = [] | ||
for (let i = 1; i <= length; ++i) { | ||
if (iterator === 1) { | ||
options.push({ | ||
value: `v-${i}`, | ||
label: `l-${i}`, | ||
disabled: i % 5 === 0, | ||
children: genOptions(depth, iterator + 1, '' + i) | ||
}) | ||
} else if (iterator === depth) { | ||
options.push({ | ||
value: `v-${prefix}-${i}`, | ||
label: `l-${prefix}-${i}`, | ||
disabled: i % 5 === 0 | ||
}) | ||
} else { | ||
options.push({ | ||
value: `v-${prefix}-${i}`, | ||
label: `l-${prefix}-${i}`, | ||
disabled: i % 5 === 0, | ||
children: genOptions(depth, iterator + 1, `${prefix}-${i}`) | ||
}) | ||
} | ||
} | ||
return options | ||
} | ||
|
||
export default { | ||
data () { | ||
return { | ||
leafOnly: true, | ||
cascade: true, | ||
showPath: true, | ||
hoverTrigger: false, | ||
filterable: false, | ||
value: null, | ||
options: genOptions() | ||
} | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# 大量数据 | ||
|
||
大量数据也可以,`virtual-scroll` 默认是打开的,所以这个例子只是为了给你看看。 | ||
|
||
下面这个例子有 5000 _ 2 _ 2 = 20000 条数据。 | ||
|
||
```html | ||
<n-space vertical> | ||
<n-space> | ||
<n-space><n-switch v-model:value="leafOnly" />Leaf Only</n-space> | ||
<n-space><n-switch v-model:value="cascade" />Cascade</n-space> | ||
<n-space><n-switch v-model:value="showPath" />Show Path</n-space> | ||
<n-space><n-switch v-model:value="hoverTrigger" />Hover Trigger</n-space> | ||
<n-space><n-switch v-model:value="filterable" />Filterable</n-space> | ||
</n-space> | ||
<n-cascader | ||
v-model:value="value" | ||
placeholder="没啥用的值" | ||
:expand-trigger="hoverTrigger ? 'hover' : 'click'" | ||
:options="options" | ||
:cascade="cascade" | ||
:leaf-only="leafOnly" | ||
:show-path="showPath" | ||
:filterable="filterable" | ||
/> | ||
</n-space> | ||
``` | ||
|
||
```js | ||
function genOptions (depth = 3, iterator = 1, prefix = '') { | ||
const length = iterator === 1 ? 5000 : 2 | ||
const options = [] | ||
for (let i = 1; i <= length; ++i) { | ||
if (iterator === 1) { | ||
options.push({ | ||
value: `v-${i}`, | ||
label: `l-${i}`, | ||
disabled: i % 5 === 0, | ||
children: genOptions(depth, iterator + 1, '' + i) | ||
}) | ||
} else if (iterator === depth) { | ||
options.push({ | ||
value: `v-${prefix}-${i}`, | ||
label: `l-${prefix}-${i}`, | ||
disabled: i % 5 === 0 | ||
}) | ||
} else { | ||
options.push({ | ||
value: `v-${prefix}-${i}`, | ||
label: `l-${prefix}-${i}`, | ||
disabled: i % 5 === 0, | ||
children: genOptions(depth, iterator + 1, `${prefix}-${i}`) | ||
}) | ||
} | ||
} | ||
return options | ||
} | ||
|
||
export default { | ||
data () { | ||
return { | ||
leafOnly: true, | ||
cascade: true, | ||
showPath: true, | ||
hoverTrigger: false, | ||
filterable: false, | ||
value: null, | ||
options: genOptions() | ||
} | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters