1.自定义属性props:组件中声明的属性,子类接受父类的值2.原始属性attrs:未声明的属性,默认自动挂在组件根元素上,设置inheritAttrs为false可以关闭自动挂载3.特殊属性class和style挂载在组件的根元素上,支持字符串、对象、数组等多种语法。定义属性的两种方式1.props:['title','likes','isPublished','commentIds','author']属性值不可验证2.属性值可验证props:{//基本类型检查(`null`和`undefined`将通过任何类型验证)propA:Number,//多种可能的类型propB:[String,Number],//必需的字符串propC:{type:String,required:true},//具有默认值的数字propD:{type:Number,default:100},//具有默认值的对象propE:{type:Object,//对象或数组默认值必须从工厂函数中获取default:function(){return{message:'hello'}}},//自定义验证函数propF:{validator:function(value){//这个值必须匹配以下字符串之一return['success','warning','danger'].indexOf(value)!==-1}}}案例:子组件
type:{{type}}
list:{{list}}
isView:{{isView}}
