为什么无效的道具:道具“价值"的类型检查失败.预期的字符串、数字、对象、布尔值,得到下面提到的程序的数组显示?

2022-01-25 00:00:00 vue.js vue-component vuejs2 vuetify.js vuex

为什么无效的道具:道具值"的类型检查失败.期望字符串、数字、对象、布尔值,得到下面提到的程序的数组显示?

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"  >

脚本:

 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);
        });
    }

推荐答案

你组件的prop usersAssignData的type可能不是Array,axios调用它似乎正在返回一个数组.尝试按照@DharaParmar 所说的操作,将道具的类型设置为数组.

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.

相关文章