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 {
|
2019-09-28 12:45:07 +00:00
|
|
|
|
data() {
|
2018-02-12 10:10:51 +00:00
|
|
|
|
return {
|
|
|
|
|
useAnim: 0,
|
|
|
|
|
value: ['a10'],
|
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, options) {
|
2019-01-12 03:33:27 +00:00
|
|
|
|
console.log('onChange', value, options);
|
|
|
|
|
this.value = value;
|
2018-02-12 10:10:51 +00:00
|
|
|
|
},
|
2019-09-28 12:45:07 +00:00
|
|
|
|
onSelect(...args) {
|
2019-01-12 03:33:27 +00:00
|
|
|
|
console.log('select ', args);
|
2018-02-12 10:10:51 +00:00
|
|
|
|
},
|
2019-09-28 12:45:07 +00:00
|
|
|
|
onDeselect(...args) {
|
2019-01-12 03:33:27 +00:00
|
|
|
|
console.log('deselect ', args);
|
2018-02-12 10:10:51 +00:00
|
|
|
|
},
|
2019-09-28 12:45:07 +00:00
|
|
|
|
useAnimation(e) {
|
2019-01-12 03:33:27 +00:00
|
|
|
|
this.useAnim = e.target.checked;
|
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++) {
|
|
|
|
|
children.push(
|
|
|
|
|
<Option key={i.toString(36) + i} disabled={i === 10} title={`中文${i}`}>
|
2019-09-28 12:45:07 +00:00
|
|
|
|
中文{i}
|
|
|
|
|
</Option>,
|
2019-01-12 03:33:27 +00:00
|
|
|
|
);
|
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 (
|
|
|
|
|
<div>
|
|
|
|
|
<h2>multiple select(scroll the menu)</h2>
|
2018-02-12 10:10:51 +00:00
|
|
|
|
|
2019-09-28 12:45:07 +00:00
|
|
|
|
<p>
|
|
|
|
|
<label>
|
2018-02-12 10:10:51 +00:00
|
|
|
|
anim
|
2019-09-28 12:45:07 +00:00
|
|
|
|
<input checked={this.useAnim} type="checkbox" onChange={this.useAnimation} />
|
|
|
|
|
</label>
|
|
|
|
|
</p>
|
2018-02-12 10:10:51 +00:00
|
|
|
|
|
2019-09-28 12:45:07 +00:00
|
|
|
|
<div style={{ width: '300px' }}>
|
|
|
|
|
<Select
|
|
|
|
|
value={this.value}
|
|
|
|
|
animation={this.useAnim ? 'slide-up' : null}
|
|
|
|
|
choiceTransitionName="rc-select-selection__choice-zoom"
|
|
|
|
|
dropdownMenuStyle={dropdownMenuStyle}
|
|
|
|
|
style={{ width: '500px' }}
|
|
|
|
|
multiple
|
|
|
|
|
allowClear
|
|
|
|
|
optionFilterProp="children"
|
|
|
|
|
optionLabelProp="children"
|
|
|
|
|
onSelect={this.onSelect}
|
|
|
|
|
onDeselect={this.onDeselect}
|
|
|
|
|
placeholder="please select"
|
|
|
|
|
onChange={this.onChange}
|
|
|
|
|
onFocus={() => console.log('focus')}
|
|
|
|
|
tokenSeparators={[' ', ',']}
|
|
|
|
|
>
|
|
|
|
|
{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>
|