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-09-28 12:45:07 +00:00
|
|
|
onChange(value) {
|
2019-01-12 03:33:27 +00:00
|
|
|
console.log(`selected ${value}`);
|
2018-02-12 10:10:51 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2019-09-28 12:45:07 +00:00
|
|
|
render() {
|
2018-02-12 10:10:51 +00:00
|
|
|
const cases = {
|
|
|
|
0: { name: 'Case 1' },
|
|
|
|
1: { name: 'Case 2' },
|
|
|
|
2: { name: 'Case 3' },
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|
2019-09-28 12:45:07 +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>
|
|
|
|
</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>
|