1 在父组件的coment绑定事件

<template>
  <div :class="classObj" class="app-wrapper">
      <app-main v-on:child-say="listenToMyBoy" />
  </div>
</template>

在父组件的methods中添加

listenToMyBoy(something){
      this.childWords = something
    }

2 在子组件中改变值

this.$emit('child-say',this.loadingStatus)

另外 子组件获取父组件的值

this.$parent.childWords  //childWords为父组件的数据或者方法

 

相关文章:

  • 2021-08-02
  • 2021-05-24
  • 2021-11-05
  • 2021-07-14
  • 2022-02-26
  • 2021-05-16
猜你喜欢
  • 2021-06-11
  • 2021-12-04
  • 2022-02-15
  • 2021-08-06
  • 2021-12-30
  • 2021-06-08
  • 2021-09-25
相关资源
相似解决方案