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';
|
|
|
|
import { fetch } from './tbFetchSuggest';
|
2018-02-12 10:10:51 +00:00
|
|
|
|
|
|
|
export default {
|
2019-09-28 12:45:07 +00:00
|
|
|
data() {
|
2018-02-12 10:10:51 +00:00
|
|
|
return {
|
|
|
|
data: [],
|
|
|
|
value: ['b11'],
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|
2018-02-12 10:10:51 +00:00
|
|
|
},
|
|
|
|
methods: {
|
2019-09-28 12:45:07 +00:00
|
|
|
onChange(value) {
|
2019-01-12 03:33:27 +00:00
|
|
|
console.log('onChange ', value);
|
|
|
|
this.value = value;
|
2018-02-12 10:10:51 +00:00
|
|
|
},
|
2019-09-28 12:45:07 +00:00
|
|
|
onSelect(value) {
|
2019-01-12 03:33:27 +00:00
|
|
|
console.log('select ', value);
|
2018-02-12 10:10:51 +00:00
|
|
|
},
|
2019-09-28 12:45:07 +00:00
|
|
|
fetchData(value) {
|
|
|
|
fetch(value, data => {
|
2019-01-12 03:33:27 +00:00
|
|
|
this.data = data;
|
|
|
|
});
|
2018-02-12 10:10:51 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2019-09-28 12:45:07 +00:00
|
|
|
render() {
|
2019-01-12 03:33:27 +00:00
|
|
|
const children = [];
|
2018-02-12 10:10:51 +00:00
|
|
|
for (let i = 10; i < 36; i++) {
|
|
|
|
// 11 => readonly selected item
|
2019-09-28 12:45:07 +00:00
|
|
|
children.push(
|
|
|
|
<Option disabled={i === 11} key={i.toString(36) + i}>
|
|
|
|
中文{i}
|
|
|
|
</Option>,
|
|
|
|
);
|
2018-02-12 10:10:51 +00:00
|
|
|
}
|
|
|
|
const dropdownMenuStyle = {
|
|
|
|
maxHeight: '200px',
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|
2019-09-28 12:45:07 +00:00
|
|
|
return (
|
2018-02-12 10:10:51 +00:00
|
|
|
<div>
|
2019-09-28 12:45:07 +00:00
|
|
|
<h2>multiple readonly default selected item</h2>
|
|
|
|
<div>
|
|
|
|
<Select
|
|
|
|
multiple
|
|
|
|
value={this.value}
|
|
|
|
animation="slide-up"
|
|
|
|
choiceTransitionName="rc-select-selection__choice-zoom"
|
|
|
|
dropdownMenuStyle={dropdownMenuStyle}
|
|
|
|
style={{ width: '500px' }}
|
|
|
|
optionFilterProp="children"
|
|
|
|
optionLabelProp="children"
|
|
|
|
placeholder="please select"
|
|
|
|
onChange={this.onChange}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</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>
|