const BookReason = { template: ` {{item.dispName}} `, props: { value: { type: String, default: undefined }, id: { type: String, default: '' }, placeholder: { type: String, default: '请选择收款事由' }, size: { type: String, default: 'default' } }, data() { return { defaultVal: this.value, list: [] }; }, created() { this.list = this.$store.state.app.bookReason }, watch: { value(newValue, oldValue) { this.defaultVal = newValue || undefined } }, methods: { filterOption(input, option) { return ( option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 ); }, handleChange(value) { this.defaultVal = value; const row = this.list.find(item => item.code == value) this.$emit('change', value, row); this.$emit('input', value); }, getCodeByName(value){ const row = this.list.find(item => item.dispName == value) return row? row.code : '' } }, }; export default BookReason