iep-ui
Version:
An enterprise-class UI design language and Vue-based implementation
69 lines (61 loc) • 1.61 kB
JavaScript
import _mergeJSXProps from 'babel-helper-vue-jsx-merge-props';
import _extends from 'babel-runtime/helpers/extends';
import PropTypes from '../_util/vue-types';
import { ConfigConsumerProps } from '../config-provider/configConsumerProps';
import InputSearch from '../input/Search';
export default {
name: 'IepBusinessSearch',
props: _extends({}, InputSearch.props),
inject: {
configProvider: { 'default': function _default() {
return ConfigConsumerProps;
} }
},
data: function data() {
return {
localValue: undefined
};
},
watch: {
value: {
handler: function handler(e) {
this.localValue = e;
},
immediate: true,
deep: true
}
},
methods: {
handleSearch: function handleSearch(e) {
var value = e.target.value;
this.localValue = value;
this.$emit('change', this.localValue);
}
},
render: function render() {
var _this = this;
var h = arguments[0];
var customizePrefixCls = this.prefixCls,
$props = this.$props,
localValue = this.localValue;
var getPrefixCls = this.configProvider.getPrefixCls;
var prefixCls = getPrefixCls('business-search', customizePrefixCls);
var placeholder = $props.placeholder;
return h(
'div',
{ 'class': prefixCls },
[h(InputSearch, _mergeJSXProps([{
attrs: {
placeholder: placeholder,
value: localValue
}
}, {
on: {
change: function change(e) {
return _this.handleSearch(e);
}
}
}]))]
);
}
};