Invalid prop: type check failed for prop "xxx". Expected Number, got String.
在子组件progress-circle.vue的template中的定义如下:
<svg :width="radius" :height="radius" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg>
在子组件progress-circle.vue的script中的props:radius和percent都是从父组件传递过来的数据
props: {
radius: {
type: Number,
default: 100
},
percent: {
type: Number,
default: 0
}
}
父组件player.vue中引用progress-circle子组件
<progress-circle radius="32" :percent="percent">
然后就报上面的错误了。
分析:由于radius是从父组件传递给子组件的数据,在父组件中定义的时候是直接定义一个变量而不是绑定一个变量,那么当传递给子组件的时候这个变量的值是一个字符串。但是在子组件中radius的类型是number,因此该变量应该还是要绑定传给子组件的。
解决的方法:只需要在父组件中做改变,在父组件中的定义如下
<progress-circle :radius="radius" :percent="percent">
在父子间中的data中定义一个变量radius,如下所示
data() {
return {
//防止快速点击造成的bug
songReady: false,
currentTime: 0,
radius: 32
}
}
Invalid prop: type check failed for prop "xxx". Expected Number, got String.的更多相关文章
- Invalid prop: type check failed for prop "XXX". Expected String, got Object.
项目是Vue的,基于elementUI的后台管理系统. Invalid prop: type check failed for prop "total". Expected Str ...
- vue调用组件,组件回调给data中的数组赋值,报错Invalid prop type check failed for prop value. Expecte
报错信息: 代码信息:调用一个tree组件,选择一些信息 <componentsTree ref="typeTreeComponent" @treeCheck="t ...
- Invalid prop: type check failed for prop "maxlength". Expected Number, got String.
1.项目中,使用element-ui的input表单的maxlength属性报错 2.使用场景: <el-input v-model="fname" maxle ...
- vue.esm.js?efeb:628 [Vue warn]: Invalid prop: type check failed for prop "defaultActive". Expected String with value "0", got Number with value 0.
vue.esm.js?efeb:628 [Vue warn]: Invalid prop: type check failed for prop "defaultActive". ...
- Invalid prop: type check failed for prop "maxlength"
Invalid prop: type check failed for prop "maxlength", element 框架时,因为想限制文本框的输入长度, maxlength ...
- Vue报错之"[Vue warn]: Invalid prop: type check failed for prop "jingzinum". Expected Number with value NaN, got String with value "fuNum"."
一.报错截图 [Vue warn]: Invalid prop: type check failed for prop "jingzinum". Expected Number w ...
- [VUE ERROR] Invalid prop: type check failed for prop "list". Expected Array, got Undefined
错误原因: 子组件 props -> list 要求接收的数据类型是 Array, 然而实际接收到的是 Undefined. 子组件代码: props: { list: { type: Arra ...
- [Vue warn]: Invalid prop: type check failed for prop "fullscreen"
fullscreen属性是Dialog弹窗中定义是否为全屏 Dialog的属性,element 官方文档中默认值是false ,于是加入是对其赋值 true,然后报了下面的错误: 解决办法:实际上并不 ...
- [Vue warn]: Invalid prop: type check failed for prop "percentage". Expected Number, got Null
Vue组件报错 <ElProgress> at packages/progress/src/progress.vue 用了element组件 绑定数据时后端给我们传的参数为null,所以组 ...
随机推荐
- Centos 7 设置 SFTP
近期要给服务器设置一个SFTP用户,可以上传删除修改的SFTP,但是禁止该用户SSH登录.这里记录下来 先升级 来源: https://blog.csdn.net/fenglailea/article ...
- 关于jQ的小案例分享
<!DOCTYPE html><html> <head> <meta charset="utf-8"> <title>表 ...
- centos7 发送邮件
yum install sendmail mailx sharutils mutt libreport-plugin-mailx -y yum update libreport-plugin-mail ...
- django如何加载外部文件
django如何加载外部文件(环境:pycharm python2.7 django1.11) 有一份新的文件夹名为:py_aiplat_demo,内含有多个文件夹(SDK,demo,data). 1 ...
- Jmeter压测学习5---HTTP Cookie管理器
我司项目暂时不需要,直接转载:https://www.cnblogs.com/yoyoketang/p/11963342.html 前言 web网站的请求大部分都有cookies,jmeter的HTT ...
- 在CentOS 6中安装和配置OrientDB社区版
OrientDB概述: OrientDB是一个开源NoSQL非关系型数据库管理系统. NoSQL数据库提供了一种用于存储和检索引用除表式数据之外的数据(例如文档数据或图形数据)的NO关系或非关系数据的 ...
- PHP审计之class_exists与任意实例化漏洞
PHP审计之class_exists与任意实例化漏洞 前言 发现PHP的一些漏洞函数挺有意思,跟着七月火师傅的文章来学习. class_exists函数 函数说明 class_exists:(PHP ...
- Java(7)流程控制语句中的for、while、do while循环
作者:季沐测试笔记 原文地址:https://www.cnblogs.com/testero/p/15201543.html 博客主页:https://www.cnblogs.com/testero ...
- Java(28)集合三Map
作者:季沐测试笔记 原文地址:https://www.cnblogs.com/testero/p/15228436.html 博客主页:https://www.cnblogs.com/testero ...
- 【UE4 C++】 解析与构建 Json 数据
准备条件 Json 格式 { "Players":[ { "Name": "Player1", "health": 20 ...