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