2016-11-18 11:46:55 +08:00
|
|
|
<template>
|
|
|
|
<div :class="prefixCls">
|
|
|
|
<i-input
|
|
|
|
:value.sync="query"
|
|
|
|
size="small"
|
|
|
|
:icon="icon"
|
|
|
|
:placeholder="placeholder"
|
|
|
|
@on-click="handleClick"></i-input>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import iInput from '../input/input.vue';
|
|
|
|
|
|
|
|
export default {
|
2016-11-23 16:27:17 +08:00
|
|
|
components: { iInput },
|
2016-11-18 11:46:55 +08:00
|
|
|
props: {
|
|
|
|
prefixCls: String,
|
|
|
|
placeholder: String,
|
|
|
|
query: String
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
icon () {
|
|
|
|
return this.query === '' ? 'ios-search' : 'ios-close';
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
handleClick () {
|
|
|
|
if (this.query === '') return;
|
|
|
|
this.query = '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|