captain-ui
Version:
有赞vue wap业务组件库
67 lines (64 loc) • 1.52 kB
JavaScript
import InputMixin from '../../../common/mixins/input-mixin';
var VALID_TYPES = ['text', 'number', 'email', 'url', 'tel', 'date', 'datetime'];
export default {
render: function render() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('div', {
directives: [{
name: "clickoutside",
rawName: "v-clickoutside",
value: _vm.doCloseFocus,
expression: "doCloseFocus"
}],
staticClass: "cap-login__input"
}, [_c('input', {
attrs: {
"type": _vm.type,
"placeholder": _vm.placeholder,
"disabled": _vm.disabled
},
domProps: {
"value": _vm.currentValue
},
on: {
"focus": function focus($event) {
_vm.isFocus = true;
},
"input": _vm.handleInput
}
}), _c('van-icon', {
directives: [{
name: "show",
rawName: "v-show",
value: _vm.isFocus && _vm.currentValue,
expression: "isFocus && currentValue"
}],
attrs: {
"name": "clear"
},
on: {
"click": _vm.clearData
}
})], 1);
},
mixins: [InputMixin],
props: {
value: String,
type: {
type: String,
default: 'text',
validator: function validator(value) {
return VALID_TYPES.indexOf(value) > -1;
}
},
placeholder: String,
disabled: Boolean
},
methods: {
clearData: function clearData() {
this.currentValue = '';
}
}
};