Vue parent component tune child component method, status updated, but not applied

//
<template>
  <section v-show="bool">11</section>
</template>
<script>
export default {
  data() {
    return {
      bool: false
    };
  },
  mounted() {
  },
  methods: {
    aaa() {
      let that = this;
      that.bool = true;
      console.log(that.bool);
      setTimeout(() => {
        that.bool = false;
        console.log(that.bool);
      }, 2000);
    }
  }
};
</script>
< hr >
//
<template>
  <section>
      <zujian></zujian>
  </section>
</template>
<script>
import zujian from "@/components/zujian";
export default {
  data() {
  },
  mounted() {
    zujian.methods.aaa();
  },
  components: {
    zujian
  }
};
</script>

after the parent component is called, the console of the child component is correct twice, but the state of the child component does not change.

Mar.04,2021

the parent component can control the child component, but the child component cannot control the parameters of the parent component. If you want to turn off the display, write the method callback on your child component and change the state


in your parent component.

self-question and answer
tune

in the form of refs
//
<template>
  <section>
      <zujian ref="zujian"></zujian>
  </section>
</template>
<script>
import zujian from "@/components/zujian";
export default {
  data() {
  },
  mounted() {
    this.$refs.zujian.aaa();
  },
  components: {
    zujian
  }
};
</script>

this.$children [0] .AAA ();

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e45f01-43125.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e45f01-43125.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?