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>
posted @ 2019-07-24 02:30  193557749  阅读(167)  评论(0编辑  收藏  举报