<template>
  <div class="work">
    <el-button type="primary" @click="vIfCommand">v-if 开关</el-button>
    <el-tag v-if="vif">vIf效果演示</el-tag>
    <br />
    <el-input v-model="input" placeholder="请输入内容" />
    <el-tag>{{input}}</el-tag>
    <child :val="val" @childByValue="childByValue" />
  </div>
</template>

<script>
import child from "@/views/work/child";

export default {
  name: "work",
  components: {
    child
  },
  data() {
    return {
      vif: false,
      input: "",
      val: "子组件默认内容"
    };
  },
  methods: {
    vIfCommand: function() {
      this.vif = !this.vif;
    },
    childByValue: function(chi) {
      console.log("bb");
      this.val = chi;
      this.input = chi;
    }
  }
};
</script>