|
@@ -41,12 +41,10 @@ export default {
|
|
|
constant: this.number || 50,
|
|
|
placeholder:placeholder[this.commit],
|
|
|
selectWidt:this.width || 180,
|
|
|
- first:ture,
|
|
|
- isFather
|
|
|
+ isFirst:true
|
|
|
};
|
|
|
},
|
|
|
async mounted() {
|
|
|
- this.first = true
|
|
|
await this.$store.dispatch(this.commit);
|
|
|
|
|
|
this.list = this.selects[this.enumer[this.commit]];
|
|
@@ -56,8 +54,8 @@ export default {
|
|
|
? this.list
|
|
|
: slice(this.list, 0, this.constant);
|
|
|
|
|
|
- throttle(this.getOptions,800)('')
|
|
|
- console.log(this.value)
|
|
|
+ throttle(this.getOptions,800)('')
|
|
|
+
|
|
|
},
|
|
|
methods: {
|
|
|
remoteMethod(query) {
|
|
@@ -66,19 +64,19 @@ export default {
|
|
|
|
|
|
},
|
|
|
getOptions(query) {
|
|
|
- console.log('进来了',this.value)
|
|
|
- let flag = (query&&item.userName.toLowerCase().indexOf(query.toLowerCase())>-1) || item.userId == query
|
|
|
this.options = this.list.filter(item=>{
|
|
|
+ let flag = (query&&item.userName.toLowerCase().indexOf(query.toLowerCase())>-1) || item.userId == query
|
|
|
if(this.multiple){
|
|
|
+
|
|
|
return flag || this.value.includes(item.userId)
|
|
|
}else{
|
|
|
return flag || item.userId == this.value
|
|
|
}
|
|
|
|
|
|
})
|
|
|
- this.first = true;
|
|
|
},
|
|
|
changeValue(val){
|
|
|
+ this.isFirst = false
|
|
|
this.$emit("input", val);
|
|
|
this.$emit("change",val)
|
|
|
}
|
|
@@ -90,6 +88,18 @@ export default {
|
|
|
setEducations: "educations",
|
|
|
};
|
|
|
},
|
|
|
+ },
|
|
|
+ watch:{
|
|
|
+ value:{
|
|
|
+ immediate:true,
|
|
|
+ deep:true,
|
|
|
+ handler(val){
|
|
|
+ if(val&&this.isFirst){
|
|
|
+ throttle(this.getOptions,800)('')
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|