vue props验证数组与对象时

1,043 阅读1分钟

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'}
        }
      }
    },