js中:
Component({
mixins: [], // minxin 方便復(fù)用代碼
data: {
}, // 組件內(nèi)部數(shù)據(jù)
props: { }, // 可給外部傳入的屬性添加默認(rèn)值
didMount() { }, // 生命周期函數(shù)
didUpdate() { },
didUnmount() { },
methods: { // 自定義事件
},
})
json中:
{
"component":true
}
使用組件的頁面 json 中:
{
"usingComponents": {
"customer": "../component/banner/banner"
}
}
使用組件的頁面 axml 中:
<view class="customer">
<customer/>
</view>