vue2 子组件 props 接收多种类型的数据


 props:{
    // 字符串
    title:{
      type: String,
      default: ''
    },
    // 数组
    list: {
      type: Array,
      default: () => []
    },
    // 数字
    num: {
      type: Number,
      default: 0
    },
    // 布尔值
    show: {
      type: Boolean,
      default: false
    },
    // 对象
     data: {
      type: Object,
      default: () => {
        return {}
      }
    },
    // 函数
    showDialog: {
      type: Function,
      default: function () { }
    }
  }

你可能感兴趣的:(vue.js)