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,所以组 ...
随机推荐
- 写SQL的套路
定义问题 转化问题 如要解决的问题是:查出每门课程成绩都大于80分学生的姓名,可以转化为:只要学生最小分数的课程大于80分,就是所有课程成绩都大于80分. 查询同名同姓学生名单并统计同名人数--> ...
- ActiveQq的代码实现
]从java代码开始再过渡到springboot Java代码的实现 1.activemq这个消息中间件有两种形式 1. p2p(生产者,消费者) 特点: 生产者: package com.lqh; ...
- three.js 在模型上移动相机
需求: 根据鼠标点击位置相机进行相应的移动, 方案: 1.实际要解决的问题就是 相机以及相机朝向位置 的坐标更新 2.使用 TWEEN 组件 优化两个点切换的补间动画 3.获取鼠标点击的位置 获取鼠标 ...
- 痞子衡嵌入式:i.MXRT全系列下FlexSPI外设AHB Master ID定义与AHB RX Buffer指定的异同
大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家介绍的是i.MXRT全系列下FlexSPI外设AHB Master ID定义与AHB RX Buffer指定的异同. 因为 i.MXRT 全系列 ...
- ServletContext 学习
ServletContext web容器在启动的时候,它会为每个web程序都创建一个对应的ServletContext对象,它代表了当前的web应用: 1.共享数据 在这个Servlet中保存了数 ...
- spring boot log4j2 最佳实践
为什么选择 log4j2 Log4j2 使用了 LMAX Disruptor 库.在多线程场景中,异步 Logger 的吞吐量比 Log4j 1.x 和 Logback 高 18 倍,延迟低几个数量级 ...
- Docker 常见命令
Docker 运行流程 辅助命令 # 1.安装完成辅助命令 docker version -------------------------- 查看docker的信息 docker info ---- ...
- CAM对象样式表
CAM对象样式表 121 160 UF_machining_task_type UF_mach_order_task_subtype 112 UF_machining_null_grp_type 无 ...
- ThreadLocalRandom类原理分析
1.Random类及其局限性 public int nextInt(int bound) { if (bound <= 0) throw new IllegalArgumentException ...
- 【数据结构与算法Python版学习笔记】递归(Recursion)——定义及应用:分形树、谢尔宾斯基三角、汉诺塔、迷宫
定义 递归是一种解决问题的方法,它把一个问题分解为越来越小的子问题,直到问题的规模小到可以被很简单直接解决. 通常为了达到分解问题的效果,递归过程中要引入一个调用自身的函数. 举例 数列求和 def ...