docs(popselect): vue3

This commit is contained in:
07akioni 2020-10-22 21:19:43 +08:00
parent 6c88053ade
commit 5ce7a9c90a
9 changed files with 10 additions and 134 deletions

View File

@ -1,12 +1,9 @@
# Basic
Basic usage of popselect.
```html
<n-popselect
v-model="value"
v-model:value="value"
:options="options"
@change="handleChange"
>
<n-tag>{{ value || 'Popselect' }}</n-tag>
</n-popselect>
@ -69,11 +66,6 @@ export default {
}
]
}
},
methods: {
handleChange (v) {
this.$NMessage.info('Value: ' + v)
}
}
}
```

View File

@ -2,9 +2,8 @@
Make single value popselect cancelable.
```html
<n-popselect
v-model="value"
v-model:value="value"
cancelable
@change="handleChange"
:options="options"
>
<n-tag>{{ value || 'Popselect' }}</n-tag>
@ -72,11 +71,6 @@ export default {
}
]
}
},
methods: {
handleChange (v) {
this.$NMessage.info('Value: ' + v)
}
}
}
```

View File

@ -1,43 +0,0 @@
# Custom Width
Set width of select menu.
```html
<n-popselect
v-model="value"
:width="240"
multiple
:options="options"
@change="handleChange"
>
<n-tag>{{ (Array.isArray(value) && value.length) ? value : 'Nothing' }}</n-tag>
</n-popselect>
```
```js
export default {
data () {
return {
value: null,
options: [{
label: 'Go Let It Out',
value: 'Go Let It Out'
}, {
label: 'Who Feels Love?',
value: 'Who Feels Love?'
}, {
label: 'Sunday Morning Call',
value: 'Sunday Morning Call',
disabled: true
}, {
label: 'Roll It Over',
value: 'Roll It Over'
}]
}
},
methods: {
handleChange (v) {
this.$NMessage.info('Value: ' + v)
}
}
}
```

View File

@ -7,30 +7,20 @@ If you want select some options but don't want a picker, you can use popselect i
basic
size
scrollable
custom-width
multiple
```
## V-model
|Prop|Event|
|-|-|
|value|change|
## Props
|Name|Type|Default|Description|
|-|-|-|-|
|value|`string \| number`|`null`||
|multiple|`boolean`|`false`||
|options|`Array<SelectOption \| SelectOptionGroup>`|`[]`||
|scrollable|`boolean`|`false`||
|multiple|`boolean`|`false`||
|size|`'small' \| 'medium' \| 'large'`|`'small'`||
|size|`'small' \| 'medium' \| 'large'`|`'medium'`||
|value|`string \| number \| Array<string \| number> \| null`|`null`||
|on-update:value|`(string \| number \| Array<string \| number> \| null) => any`|`undefined`||
For SelectOption & SelectOptionGroup, see [Select](n-select#SelectOption-Type)
For other props, see [Popover](n-popover#Props)
## Events
|Name|Parameters|Description|
|-|-|-|
|change|`string \| number \| Array<string \| number> \| null`||

View File

@ -4,10 +4,9 @@ Select multiple value in popselect.
```html
<n-popselect
v-model="value"
v-model:value="value"
multiple
:options="options"
@change="handleChange"
>
<n-tag>{{ (Array.isArray(value) && value.length) ? value : 'Nothing' }}</n-tag>
</n-popselect>
@ -32,11 +31,6 @@ export default {
value: 'Roll It Over'
}]
}
},
methods: {
handleChange (value) {
this.$NMessage.info(JSON.stringify(value))
}
}
}
```

View File

@ -2,11 +2,10 @@
```html
<n-popselect
v-model="value"
v-model:value="value"
:options="options"
size="medium"
scrollable
@change="handleChange"
>
<n-tag style="margin-right: 8px;">{{ value || 'Popselect' }}</n-tag>
</n-popselect>
@ -69,11 +68,6 @@ export default {
}
]
}
},
methods: {
handleChange (v) {
this.$NMessage.info('Value: ' + v)
}
}
}
```

View File

@ -2,18 +2,16 @@
```html
<n-popselect
v-model="value"
v-model:value="value"
:options="options"
size="medium"
@change="handleChange"
>
<n-tag style="margin-right: 8px;">{{ value || 'Popselect' }}</n-tag>
</n-popselect>
<n-popselect
v-model="value"
v-model:value="value"
:options="options"
size="large"
@change="handleChange"
>
<n-tag>{{ value || 'Popselect' }}</n-tag>
</n-popselect>
@ -76,11 +74,6 @@ export default {
}
]
}
},
methods: {
handleChange (v) {
this.$NMessage.info('Value: ' + v)
}
}
}
```

View File

@ -1,37 +0,0 @@
# 自定义宽度
设个宽度吧。
```html
<n-popselect
v-model:value="value"
:width="400"
multiple
:options="options"
>
<n-tag>{{ (Array.isArray(value) && value.length) ? value : '没了' }}</n-tag>
</n-popselect>
```
```js
export default {
data () {
return {
value: null,
options: [{
label: 'Go Let It Out',
value: 'Go Let It Out'
}, {
label: 'Who Feels Love?',
value: 'Who Feels Love?'
}, {
label: 'Sunday Morning Call',
value: 'Sunday Morning Call',
disabled: true
}, {
label: 'Roll It Over',
value: 'Roll It Over'
}]
}
}
}
```

View File

@ -7,7 +7,6 @@
basic
size
scrollable
custom-width
multiple
```