naive-ui/demo/documentation/components/dropdown/zhCN/size.md

105 lines
1.7 KiB
Markdown
Raw Normal View History

2019-12-14 02:05:31 +08:00
# 尺寸
```html
<n-dropdown
placement="bottom-start"
trigger="click"
size="small"
@select="handleSelect"
2020-02-04 22:07:55 +08:00
:options="options"
2019-12-14 02:05:31 +08:00
>
<n-button :keyboard="false">小号</n-button>
2019-12-14 02:05:31 +08:00
</n-dropdown>
<n-dropdown
placement="bottom-start"
trigger="click"
size="medium"
@select="handleSelect"
2020-02-04 22:07:55 +08:00
:options="options"
2019-12-14 02:05:31 +08:00
>
<n-button :keyboard="false">中号</n-button>
2019-12-14 02:05:31 +08:00
</n-dropdown>
<n-dropdown
placement="bottom-start"
trigger="click"
size="large"
@select="handleSelect"
2020-02-04 22:07:55 +08:00
:options="options"
2019-12-14 02:05:31 +08:00
>
<n-button :keyboard="false">大号</n-button>
2020-02-04 22:07:55 +08:00
</n-dropdown>
<n-dropdown
placement="bottom-start"
trigger="click"
size="large"
@select="handleSelect"
:options="options"
>
<n-button :keyboard="false">巨大号</n-button>
2019-12-14 02:05:31 +08:00
</n-dropdown>
```
```js
2020-02-04 22:07:55 +08:00
const options = [
{
label: '杰·盖茨比',
value: 'jay gatsby'
2020-02-04 22:07:55 +08:00
},
{
label: '黛西·布坎南',
value: 'daisy buchanan'
2020-02-04 22:07:55 +08:00
},
{
type: 'divider'
},
{
label: '尼克·卡拉威',
value: 'nick carraway'
2020-02-04 22:07:55 +08:00
},
{
label: '其他',
value: 'others',
2020-02-04 22:07:55 +08:00
children: [
{
label: '乔丹·贝克',
value: 'jordan baker'
2020-02-04 22:07:55 +08:00
},
{
label: '汤姆·布坎南',
value: 'tom buchanan'
2020-02-04 22:07:55 +08:00
},
{
label: '其他',
value: 'others',
2020-02-04 22:07:55 +08:00
children: [
{
label: '鸡肉',
value: 'chicken'
2020-02-04 22:07:55 +08:00
},
{
label: '牛肉',
value: 'beef'
2020-02-04 22:07:55 +08:00
}
]
}
]
}
]
2019-12-14 02:05:31 +08:00
export default {
2020-02-04 22:07:55 +08:00
data () {
return {
options
}
},
2019-12-14 02:05:31 +08:00
methods: {
handleSelect (name) {
this.$NMessage.info(name)
}
}
}
```
```css
.n-button {
margin: 0 8px 12px 0;
}
```