Select add allowCreate prop

This commit is contained in:
梁灏 2019-09-09 13:45:01 +08:00
parent 616c19f5be
commit 255b69abd6
5 changed files with 115 additions and 51 deletions

View file

@ -1,52 +1,60 @@
<template>
<div style="margin: 100px;">
<Select v-model="model1" filterable style="width:200px" prefix="ios-albums">
<!-- <Select v-model="model1" filterable style="width:200px" prefix="ios-albums">-->
<!-- <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>-->
<!-- </Select>-->
<!-- <Select v-model="model10" filterable :max-tag-count="2" multiple style="width:400px">-->
<!-- <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>-->
<!-- </Select>-->
<!-- <Select v-model="model10" filterable :max-tag-count="2" multiple style="width:400px" prefix="ios-albums">-->
<!-- <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>-->
<!-- </Select>-->
<!-- <br><br>-->
<!-- <Select v-model="model1" style="width:200px">-->
<!-- <Icon type="ios-alarm" slot="prefix" color="red" />-->
<!-- <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>-->
<!-- </Select>-->
<!-- <Select v-model="model1" style="width:200px">-->
<!-- <Avatar src="https://dev-file.iviewui.com/userinfoPDvn9gKWYihR24SpgC319vXY8qniCqj4/avatar" slot="prefix" size="small" />-->
<!-- <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>-->
<!-- </Select>-->
<!-- <Select v-model="model10" :max-tag-count="3" :max-tag-placeholder="more" multiple style="width:400px" prefix="ios-albums">-->
<!-- <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>-->
<!-- </Select>-->
<!-- <br><br>-->
<!-- <Select size="small" v-model="model1" style="width:200px" prefix="ios-albums">-->
<!-- <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>-->
<!-- </Select>-->
<!-- <Select size="small" v-model="model10" multiple style="width:400px" prefix="ios-albums">-->
<!-- <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>-->
<!-- </Select>-->
<!-- <br><br>-->
<!-- <Select size="large" v-model="model1" style="width:200px" prefix="ios-albums">-->
<!-- <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>-->
<!-- </Select>-->
<!-- <Select size="large" v-model="model10" multiple style="width:400px" prefix="ios-albums">-->
<!-- <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>-->
<!-- </Select>-->
<Divider></Divider>
<Select v-model="model13" filterable allow-create @on-create="handleCreate" style="width:260px">
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
<!-- <Select v-model="model12" multiple filterable allow-create @on-create="handleCreate" style="width:260px">-->
<!-- <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>-->
<!-- </Select>-->
<Select v-model="model10" filterable :max-tag-count="2" multiple style="width:400px">
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
<Select v-model="model10" filterable :max-tag-count="2" multiple style="width:400px" prefix="ios-albums">
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
<br><br>
<Select v-model="model1" style="width:200px">
<Icon type="ios-alarm" slot="prefix" color="red" />
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
<Select v-model="model1" style="width:200px">
<Avatar src="https://dev-file.iviewui.com/userinfoPDvn9gKWYihR24SpgC319vXY8qniCqj4/avatar" slot="prefix" size="small" />
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
<Select v-model="model10" :max-tag-count="3" :max-tag-placeholder="more" multiple style="width:400px" prefix="ios-albums">
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
<br><br>
<Select size="small" v-model="model1" style="width:200px" prefix="ios-albums">
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
<Select size="small" v-model="model10" multiple style="width:400px" prefix="ios-albums">
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
<br><br>
<Select size="large" v-model="model1" style="width:200px" prefix="ios-albums">
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
<Select size="large" v-model="model10" multiple style="width:400px" prefix="ios-albums">
<Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
</div>
</template>
<script>
@ -60,7 +68,7 @@
},
{
value: 'London',
label: 'London'
label: 'London2'
},
{
value: 'Sydney',
@ -80,12 +88,21 @@
}
],
model1: '',
model10: []
model10: [],
model12: [],
model13: ''
}
},
methods: {
more (num) {
return 'more' + num;
},
handleCreate (val) {
console.log(111,val);
this.cityList.push({
value: val,
label: val
});
}
}
}