为什么道具无效:道具“值”的类型检查失败。下面提到的程序需要字符串、数字、对象、布尔值、数组显示吗?

VIG*_*R R 5 vue.js vue-component vuex vuejs2 vuetify.js

为什么道具无效:道具“值”的类型检查失败。下面提到的程序需要字符串、数字、对象、布尔值、数组显示吗?

html:

<model-select :options="usersAssignData"  v-model="userNameData" class="form-control col-sm-4" @keyup.native="getUser"  >
Run Code Online (Sandbox Code Playgroud)

脚本:

 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);
        });
    }
Run Code Online (Sandbox Code Playgroud)

小智 3

您的组件的prop 的类型可能usersAssignData不是数组,并且 axios 调用它似乎返回一个数组。尝试按照 @DharaParmar 所说的操作,将 prop 的类型设置为数组。