为什么无效的道具:道具“价值"的类型检查失败.预期的字符串、数字、对象、布尔值,得到下面提到的程序的数组显示? [英] Why Invalid prop: type check failed for prop "value". Expected String, Number, Object, Boolean, got Array shows for the program below mention?

查看:29
本文介绍了为什么无效的道具:道具“价值"的类型检查失败.预期的字符串、数字、对象、布尔值,得到下面提到的程序的数组显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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 usersAssignDatatype可能不是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.

这篇关于为什么无效的道具:道具“价值"的类型检查失败.预期的字符串、数字、对象、布尔值,得到下面提到的程序的数组显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆