-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
1 parent
7cd4f39
commit f3791aa
Showing
5 changed files
with
68 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
<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> | ||
``` | ||
|
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