update AutoComplete

This commit is contained in:
梁灏 2017-08-24 13:49:33 +08:00
parent b575fe2c6c
commit 9cc6213ca4
2 changed files with 13 additions and 4 deletions

View file

@ -1,6 +1,6 @@
<template>
<div style="margin: 100px;width: 200px;">
<AutoComplete transfer v-model="value" :data="data" @on-search="handleSearch" @on-change="hc" :filter-method="fm">
<AutoComplete transfer v-model="value" clearable icon="ios-search" :data="data" @on-search="handleSearch" @on-change="hc" :filter-method="fm">
<!--<Option v-for="item in data" :value="item" :label="item" :key="item">-->
<!--<span style="color: red">{{ item }}</span>-->
<!--</Option>-->

View file

@ -21,7 +21,7 @@
:placeholder="placeholder"
:disabled="disabled"
:size="size"
:icon="closeIcon"
:icon="inputIcon"
@on-click="handleClear"
@on-focus="handleFocus"
@on-blur="handleBlur"></i-input>
@ -71,6 +71,9 @@
return oneOf(value, ['small', 'large', 'default']);
}
},
icon: {
type: String
},
filterMethod: {
type: [Function, Boolean],
default: false
@ -87,8 +90,14 @@
};
},
computed: {
closeIcon () {
return this.clearable && this.currentValue ? 'ios-close' : '';
inputIcon () {
let icon = '';
if (this.clearable && this.currentValue) {
icon = 'ios-close';
} else if (this.icon) {
icon = this.icon;
}
return icon;
},
filteredData () {
if (this.filterMethod) {