1.全局引用
在components下面建立通用的组件
header-list
<template>
<view class="header" :style="{ background : activityColor }">
<view>
123123
</view>
</view>
</template><script>
export default {
name: "header-list",
// 动态穿的参数,可多个
props: {
activityColor: {
type: String,
default: 'white'
},
},
data() {
return {};
}
}
</script><style>
.header {
width: 100%;
height: 200rpx;
}
</style>
在main.js 文件夹下全局注册