设置一个 test
组件
<template>
<view>
<view>a:{{n.a}}</view>
<view>b:{{n.b}}</view>
</view>
</template>
<script>
export default {
props: {
a: String,
b: String
},
data() {
return {
n: {}
};
},
mounted() {
this.n = {
a: this.a,
b: this.b
}
}
}
</script>
页面上使用多个该组件
<template>
<view>
<test a="a" b="b" />
<test a="a" b="bb" />
</view>
</template>
运行到百度真机
项目在附件中