vue父传子
父组件:home
<template>
<div id="bigData">
<button @click="fu()">父传子</button>
<comb :datas="xianying"></comb>
</div>
</template>
<script>
import coma from "../comB";
export default {
components: {
comb
},
data() {
return {
xianying: true //父传子
};
},
methods: {
fu() {
this.xianying = !this.xianying;
},
}
};
</script>
</style>
子组件: comB
<template>
<div id="comb">
我是 comB组件---{{datas}}
</div>
</template>
<script>
export default {
props: ["datas"]
};
</script>
<style>
</style>