-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tree-select): add action slot (#1790)
* feat: add action slot * fix: can copy * Update src/tree-select/demos/enUS/action.demo.md * Update src/tree-select/demos/zhCN/action.demo.md Co-authored-by: yugang.cao <[email protected]> Co-authored-by: 07akioni <[email protected]>
- Loading branch information
1 parent
577eda4
commit 39a0608
Showing
9 changed files
with
220 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Action slot | ||
|
||
Maybe you need to use this slot in the tree selection menu. | ||
|
||
```html | ||
<n-tree-select | ||
:options="options" | ||
default-value="Drive My Car" | ||
@update:value="handleUpdateValue" | ||
> | ||
<template #action>You can customize some operations here.</template> | ||
</n-tree-select> | ||
``` | ||
|
||
```js | ||
import { defineComponent } from 'vue' | ||
|
||
export default defineComponent({ | ||
setup () { | ||
return { | ||
handleUpdateValue (...args) { | ||
console.log(...args) | ||
}, | ||
options: [ | ||
{ | ||
label: 'Rubber Soul', | ||
key: 'Rubber Soul', | ||
children: [ | ||
{ | ||
label: | ||
"Everybody's Got Something to Hide Except Me and My Monkey", | ||
key: "Everybody's Got Something to Hide Except Me and My Monkey" | ||
}, | ||
{ | ||
label: 'Drive My Car', | ||
key: 'Drive My Car', | ||
disabled: true | ||
}, | ||
{ | ||
label: 'Norwegian Wood', | ||
key: 'Norwegian Wood' | ||
}, | ||
{ | ||
label: "You Won't See", | ||
key: "You Won't See", | ||
disabled: true | ||
}, | ||
{ | ||
label: 'Nowhere Man', | ||
key: 'Nowhere Man' | ||
}, | ||
{ | ||
label: 'Think For Yourself', | ||
key: 'Think For Yourself' | ||
}, | ||
{ | ||
label: 'The Word', | ||
key: 'The Word' | ||
}, | ||
{ | ||
label: 'Michelle', | ||
key: 'Michelle', | ||
disabled: true | ||
}, | ||
{ | ||
label: 'What goes on', | ||
key: 'What goes on' | ||
}, | ||
{ | ||
label: 'Girl', | ||
key: 'Girl' | ||
}, | ||
{ | ||
label: "I'm looking through you", | ||
key: "I'm looking through you" | ||
}, | ||
{ | ||
label: 'In My Life', | ||
key: 'In My Life' | ||
}, | ||
{ | ||
label: 'Wait', | ||
key: 'Wait' | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
}) | ||
``` |
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,91 @@ | ||
# 操作插槽 | ||
|
||
可能你需要在树型选择菜单里用这个插槽。 | ||
|
||
```html | ||
<n-tree-select | ||
:options="options" | ||
default-value="Drive My Car" | ||
@update:value="handleUpdateValue" | ||
> | ||
<template #action>你可以在这里自定义一些操作</template> | ||
</n-tree-select> | ||
``` | ||
|
||
```js | ||
import { defineComponent } from 'vue' | ||
|
||
export default defineComponent({ | ||
setup () { | ||
return { | ||
handleUpdateValue (...args) { | ||
console.log(...args) | ||
}, | ||
options: [ | ||
{ | ||
label: 'Rubber Soul', | ||
key: 'Rubber Soul', | ||
children: [ | ||
{ | ||
label: | ||
"Everybody's Got Something to Hide Except Me and My Monkey", | ||
key: "Everybody's Got Something to Hide Except Me and My Monkey" | ||
}, | ||
{ | ||
label: 'Drive My Car', | ||
key: 'Drive My Car', | ||
disabled: true | ||
}, | ||
{ | ||
label: 'Norwegian Wood', | ||
key: 'Norwegian Wood' | ||
}, | ||
{ | ||
label: "You Won't See", | ||
key: "You Won't See", | ||
disabled: true | ||
}, | ||
{ | ||
label: 'Nowhere Man', | ||
key: 'Nowhere Man' | ||
}, | ||
{ | ||
label: 'Think For Yourself', | ||
key: 'Think For Yourself' | ||
}, | ||
{ | ||
label: 'The Word', | ||
key: 'The Word' | ||
}, | ||
{ | ||
label: 'Michelle', | ||
key: 'Michelle', | ||
disabled: true | ||
}, | ||
{ | ||
label: 'What goes on', | ||
key: 'What goes on' | ||
}, | ||
{ | ||
label: 'Girl', | ||
key: 'Girl' | ||
}, | ||
{ | ||
label: "I'm looking through you", | ||
key: "I'm looking through you" | ||
}, | ||
{ | ||
label: 'In My Life', | ||
key: 'In My Life' | ||
}, | ||
{ | ||
label: 'Wait', | ||
key: 'Wait' | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
}) | ||
``` |
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