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

51 lines
1.2 KiB
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, OptGroup } 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, option) {
2019-01-12 03:33:27 +00:00
console.log(`selected ${value}`, option);
2018-02-12 10:10:51 +00:00
},
},
2019-09-28 12:45:07 +00:00
render() {
return (
<div>
<h2>Select OptGroup</h2>
<div style={{ width: '300px' }}>
<Select
placeholder="placeholder"
defaultValue="lucy"
showSearch={false}
style={{ width: '500px' }}
onChange={this.onChange}
>
<OptGroup>
<span slot="label">manager</span>
<Option value="jack" test-prop="jack-prop">
<b
style={{
color: 'red',
}}
>
jack
</b>
</Option>
<Option value="lucy" test-prop="lucy-prop">
lucy
</Option>
</OptGroup>
<OptGroup label="engineer">
<Option value="yiminghe" test-prop="yiminghe-prop">
yiminghe
</Option>
</OptGroup>
</Select>
</div>
2018-02-12 10:10:51 +00:00
</div>
2019-09-28 12:45:07 +00:00
);
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>