This commit is contained in:
梁灏 2018-01-23 16:30:34 +08:00
parent 037de0520c
commit feb21a0a16
2 changed files with 96 additions and 36 deletions

View file

@ -167,50 +167,105 @@
<!--}--> <!--}-->
<!--</script>--> <!--</script>-->
<!--<template>-->
<!--<div style="width: 300px">-->
<!--<Select-->
<!--v-model="model14"-->
<!--multiple-->
<!--filterable-->
<!--remote-->
<!--:remote-method="remoteMethod2"-->
<!--:loading="loading2">-->
<!--<Option v-for="(option, index) in options2" :value="option.value" :key="index">{{option.label}}</Option>-->
<!--</Select>-->
<!--</div>-->
<!--</template>-->
<!--<script>-->
<!--export default {-->
<!--data () {-->
<!--return {-->
<!--model13: '',-->
<!--loading1: false,-->
<!--options1: [],-->
<!--model14: [],-->
<!--loading2: false,-->
<!--options2: [],-->
<!--list: ['a', 'b', 'c']-->
<!--}-->
<!--},-->
<!--methods: {-->
<!--remoteMethod2 (query) {-->
<!--if (query !== '') {-->
<!--this.loading2 = true;-->
<!--setTimeout(() => {-->
<!--this.loading2 = false;-->
<!--const list = this.list.map(item => {-->
<!--return {-->
<!--value: item,-->
<!--label: item-->
<!--};-->
<!--});-->
<!--this.options2 = list.filter(item => item.label.toLowerCase().indexOf(query.toLowerCase()) > -1);-->
<!--}, 200);-->
<!--} else {-->
<!--this.options2 = [];-->
<!--}-->
<!--}-->
<!--}-->
<!--}-->
<!--</script>-->
<template> <template>
<div style="width: 300px"> <Row>
<Select <Col span="12" style="padding-right:10px">
v-model="model14" <Select v-model="model11" disabled filterable>
multiple <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
filterable
remote
:remote-method="remoteMethod2"
:loading="loading2">
<Option v-for="(option, index) in options2" :value="option.value" :key="index">{{option.label}}</Option>
</Select> </Select>
</div> </Col>
<Col span="12">
<!--<Select v-model="model12" filterable multiple>-->
<!--<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>-->
<!--</Select>-->
<Input v-model="model13" disabled="" />
</Col>
</Row>
</template> </template>
<script> <script>
export default { export default {
data () { data () {
return { return {
model13: '', cityList: [
loading1: false, {
options1: [], value: 'New York',
model14: [], label: 'New York'
loading2: false, },
options2: [], {
list: ['a', 'b', 'c'] value: 'London',
} label: 'London'
}, },
methods: { {
remoteMethod2 (query) { value: 'Sydney',
if (query !== '') { label: 'Sydney'
this.loading2 = true; },
setTimeout(() => { {
this.loading2 = false; value: 'Ottawa',
const list = this.list.map(item => { label: 'Ottawa'
return { },
value: item, {
label: item value: 'Paris',
}; label: 'Paris'
}); },
this.options2 = list.filter(item => item.label.toLowerCase().indexOf(query.toLowerCase()) > -1); {
}, 200); value: 'Canberra',
} else { label: 'Canberra'
this.options2 = []; }
} ],
model11: 'New York',
model12: [],
model13: 'New York'
} }
} }
} }
</script> </script>

View file

@ -149,6 +149,11 @@
position: relative; position: relative;
cursor: pointer; cursor: pointer;
.placeholder(); .placeholder();
&[disabled]{
cursor: @cursor-disabled;
color: #ccc;
}
} }
&-single &-input{ &-single &-input{