vue props验证数组与对象时

原文链接: https://juejin.im/post/5b4d8d3451882519eb658da0

props

    props:
      //数组
      imageList:{
        type: Array,
        default: ()=>[
          {imageName:'p1',url: 'http://gplove.top/dog1.png'},
          {imageName:'p2',url: 'http://gplove.top/dog2.png'},
          {imageName:'p3',url: 'http://gplove.top/dog3.png'},
        ]
      },
      //对象
      audio:{
        type: Object,
        default: ()=>{
          return {audioName:'多余的解释.mp3',audioUrl:'http://gplove.top/audio1.mp3'}
        }
      }
    },
复制代码

你可能感兴趣的:(vue props验证数组与对象时)