Reputation: 77
Why Invalid prop: type check failed for prop "value". Expected String, Number, Object, Boolean, got Array shows for the program below mention?
html:
<model-select :options="usersAssignData" v-model="userNameData" class="form-control col-sm-4" @keyup.native="getUser" >
script:
getUser(e) {
console.log("idd",this.selectedZone)
var user = e.target.value;
axios.get("/helpdesk/getUsers", {
params: {
q: user,
account_id: this.selectedZone,
searchOption: 'username'
},
headers: {
'Authorization': localStorage.getItem('token')
}
})
.then(response => {
this.usersAssignData = response.data
})
.catch(error => {
reject(error);
console.log(error);
});
}
Upvotes: 5
Views: 15402
Reputation: 387
hey this works for me:
data() {
return {
usersAssignData:Array/Object/String/Number,
}
}
now usersAssignData can be Array or Object or String Or Number and your not gonna see that error anymore ;)
Upvotes: -1
Reputation: 723
The type of the prop usersAssignData
of your component is probably not an Array, and the axios call it seems to be returning an Array. Try doing what @DharaParmar said, setting the type of the prop as an array.
Upvotes: 3
Reputation: 293
<script>
export default {
props: {
usersAssignData: {
type: Array,
default: () => [],
},
},
}
</script>
Upvotes: 2