You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/select/demo/options.md

48 lines
917 B

<cn>
#### 从数据直接生成
使用 `options` 把 JSON 数据直接生成选择列表。
</cn>
<us>
#### Generate form options
The select list can be populated using `options` property. This is a quick and easy way to provide the select content.
</us>
```html
<template>
<a-select defaultValue="beijing" style="width: 120px" @change="handleChange" :options="options"/>
</template>
<script>
export default {
data(){
return {
options: [
{
label: '北京',
value: 'beijing',
title: '北京 010',
key: '010',
}, {
label: '上海',
value: 'shanghai',
key: '021',
}, {
label: '杭州',
value: 'hangzhou',
key: '0571',
disabled: true,
}
]
}
},
methods: {
handleChange(value) {
console.log(`selected ${value}`);
}
}
}
</script>
```