update AutoComplete
This commit is contained in:
parent
fed3e09d15
commit
7af00356a9
4 changed files with 8 additions and 3 deletions
|
@ -30,7 +30,7 @@
|
|||
]
|
||||
},
|
||||
hc (v) {
|
||||
console.log(v)
|
||||
// console.log(v)
|
||||
},
|
||||
fm (value, item) {
|
||||
return item.toUpperCase().indexOf(value.toUpperCase()) !== -1;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80">
|
||||
<Form-item prop="name">
|
||||
<span slot="label"><Icon type="ionic"></Icon></span>
|
||||
<Input v-model="formValidate.name" placeholder="请输入姓名"></Input>
|
||||
<AutoComplete v-model="formValidate.name" :data="['Li','Liang','Zhang']" placeholder="请输入姓名"></AutoComplete>
|
||||
</Form-item>
|
||||
<Form-item label="邮箱" prop="mail">
|
||||
<Input v-model="formValidate.mail" placeholder="请输入邮箱"></Input>
|
||||
|
@ -56,6 +56,7 @@
|
|||
export default {
|
||||
data () {
|
||||
return {
|
||||
name: '',
|
||||
formValidate: {
|
||||
name: '',
|
||||
mail: '',
|
||||
|
@ -68,7 +69,7 @@
|
|||
},
|
||||
ruleValidate: {
|
||||
name: [
|
||||
{ required: true, message: '姓名不能为空', trigger: 'blur' }
|
||||
{ required: true, message: '姓名不能为空', trigger: 'change' }
|
||||
],
|
||||
mail: [
|
||||
{ required: true, message: '邮箱不能为空', trigger: 'blur' },
|
||||
|
|
|
@ -36,9 +36,11 @@
|
|||
import iOption from '../select/option.vue';
|
||||
import iInput from '../input/input.vue';
|
||||
import { oneOf } from '../../utils/assist';
|
||||
import Emitter from '../../mixins/emitter';
|
||||
|
||||
export default {
|
||||
name: 'AutoComplete',
|
||||
mixins: [ Emitter ],
|
||||
components: { iSelect, iOption, iInput },
|
||||
props: {
|
||||
value: {
|
||||
|
@ -103,6 +105,7 @@
|
|||
this.$refs.select.query = val;
|
||||
this.$emit('input', val);
|
||||
this.$emit('on-change', val);
|
||||
this.dispatch('FormItem', 'on-form-change', val);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -685,6 +685,7 @@
|
|||
|
||||
this.$on('on-select-selected', (value) => {
|
||||
if (this.model === value) {
|
||||
if (this.autoComplete) this.$emit('on-change', value);
|
||||
this.hideMenu();
|
||||
} else {
|
||||
if (this.multiple) {
|
||||
|
|
Loading…
Add table
Reference in a new issue