import { custTypeFindAllList } from '@/api/custType' const custType = { template: ` {{ item.name }} `, props: { value: { type: String, }, id: { type: String, default: '' }, placeholder: { type: String, default: '请选择客户类型' } }, data() { return { defaultVal: this.value, list: [] }; }, mounted() { this.getList() }, watch: { value(newValue, oldValue) { this.defaultVal = newValue } }, methods: { filterOption (input, option) { return ( option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 || option.data.attrs.pinyin.toLowerCase().indexOf(input.toLowerCase()) >= 0 ) }, handleChange(value) { this.defaultVal = value; this.$emit('change', value); this.$emit('input', value); }, getList () { custTypeFindAllList().then(res => { if (res.status == 200) { this.list = res.data } else { this.list = [] } }) }, }, }; export default custType