当前位置:网站首页>Props with type Object/Array must...
Props with type Object/Array must...
2022-07-26 20:29:00 【大象与小蚂蚁的生活】
就是Props在传值类型为Object/Array时,如果需要配置default值(如果没有配置default值,则不会有这个报错),那必须要使用函数来return这个default值,而不能像基本数据类型那样直接写default:xxx
//错误写法
props: {
rlist: {
type:Array,
default: [1, 2, 3, 4, 5]
}
}
如果这样写,就会报上面的错误
解决方法
//正确写法
props: {
rlist: {
type:Array,
default: function() {
return [1, 2, 3, 4, 5]
}
}
}
//当然,我们可以使用箭头函数来写,还显得简单很多
props: {
rlist: {
type:Array,
default: () => [1, 2, 3, 4, 5]
}
}
边栏推荐
- Difference between redis hash and string
- GOM跟GEE登陆器列表文件加密教程
- Go+mysql+redis+vue3 simple chat room, bullet 5: synchronize messages to MySQL using message queues and scheduled tasks
- kubernetes之Deployment
- [Oracle training] - deploy Ogg known as zero downtime migration
- 08_ UE4 advanced_ Start end pause menu UI
- About: get the domain controller of the current client login
- 银河证券场内基金低佣金开户靠谱吗,可靠安全吗
- 【问题篇】浏览器get请求带token
- Interceptors
猜你喜欢

SPI配置

Remember the idea of solving the problem of invalid bound statement xxxxx once

Leetcode linked list problem - 19. Delete the penultimate node of the linked list (learn the linked list with one question and one article)

详解西部数据SMR叠瓦式硬盘的190二级编译器(译码表)模块

【HCIA安全】NAT网络地址转换

详细图解b树及C语言实现

游览器——游览器游览器缓存

牛客刷题——Mysql系列

2022-7-26 第七组 抽象和接口
![[must read new] Keya valuation analysis of University of technology, heating energy-saving products](/img/e8/c3ac4e5f11db58031cb9249a4ba0f4.jpg)
[must read new] Keya valuation analysis of University of technology, heating energy-saving products
随机推荐
【HarmonyOS议题资料下载】HDD杭州站·线下沙龙专注应用创新 展现鸿蒙生态魅力
【打新必读】工大科雅估值分析,供热节能产品
Apaas low code platform (I) | leave complexity to yourself and simplicity to users
牛客多校-Journey-(建图distra+卡常优化)
kubernetes之Deployment
How to block the legendary GEE engine version? Close player account tutorial through script + engine
2022开放原子全球开源峰会议程速递 | 7 月 27 日分论坛议程一览
Explain the 190 secondary compiler (decoding table) module of SMR laminated hard disk of Western data in detail
JDBC的连接
GOM登录器配置免费版生成图文教程
ROS2节点通信实现零拷贝
详细图解b树及C语言实现
Basic use of livedatade
Deployment of kubernetes
Line detection based on Hough transform (matlab)
记一次invalid bound statement xxxxxx 问题解决思路
[HCIA security] user authentication
银河证券场内基金低佣金开户靠谱吗,可靠安全吗
In addition to "adding machines", in fact, your micro service can be optimized like this
Go+mysql+redis+vue3 simple chat room, bullet 5: synchronize messages to MySQL using message queues and scheduled tasks