首页
IT培训常见问题
企业资讯
学员活动
师资团队
图书教材
发布 : Web前端培训 发布时间:2021-07-19 15:59:34
props 是VUE中子组件能获得父组件值得唯一通道,props可以给传进来得值进行默认值设置,以及他得类型
- props: {
- demoString: {
- type: String,
- default: ''
- },
- demoNumber: {
- type: Number,
- default: 0
- },
- demoBoolean: {
- type: Boolean,
- default: true
- },
- demoArray: {
- type: Array,
- default: () => []
- },
- demoObject: {
- type: Object,
- default: () => ({})
- },
- demoFunction: {
- type: Function,
- default: function () { }
- }
- refArr: {
- type: Array,default: () => {return []
- }
- },
- refFun: {
- type: Function,default: () => () => {}
- },
- refObj: {
- type: Object,default: () => ({}) //这里是注意是括弧,必须是括弧。
- }
咨询还可获得
对应免费课程