//父组件
//html
<my-list :list="list"></my-list>
//js:
list:{
typeName:"home"
},
//组件引入
<config>
{
navigationBarTitleText: 'test',
navigationBarBackgroundColor:"#FFFFFF",
navigationBarTextStyle:"black",
usingComponents: {
"my-list": "../components/my-list" //组件位置
},
}
</config>
//子组件内容:
wepy.component({
props : {
list: Object //
},
attached(){
this.list.typeName
}

组件是有自己的生命周期的,需要自行看API
https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/lifetimes.html
网友评论