ant-design-vue/components/vc-select/demo/optionLabelProp.vue

31 lines
654 B
Vue
Raw Normal View History

2018-02-12 10:10:51 +00:00
<script>
2019-01-12 03:33:27 +00:00
import Select, { Option } from '../index';
import '../assets/index.less';
2018-02-12 10:10:51 +00:00
export default {
methods: {
2019-02-01 09:23:00 +00:00
onChange (value) {
2019-01-12 03:33:27 +00:00
console.log(`selected ${value}`);
2018-02-12 10:10:51 +00:00
},
},
render () {
const cases = {
0: { name: 'Case 1' },
1: { name: 'Case 2' },
2: { name: 'Case 3' },
2019-01-12 03:33:27 +00:00
};
2018-02-12 10:10:51 +00:00
return (<div>
<h2>Select optionLabelProp</h2>
<Select style={{ width: '500px' }} optionLabelProp='children' multiple allowClear>
{
Object.keys(cases).map(key => (
<Option key={key} value={key}>{cases[key].name}</Option>
))
}
</Select>
2019-01-12 03:33:27 +00:00
</div>);
2018-02-12 10:10:51 +00:00
},
2019-01-12 03:33:27 +00:00
};
2018-02-12 10:10:51 +00:00
</script>