vue subassembly change the value of parent element

1 in the parent component of the binding events coment

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

Add in the methods of the parent component

listenToMyBoy(something){
      this.childWords = something
    }

2 to change the value in the subassembly

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

Further subassembly obtain the value of parent element

this. $ parent.childWords // Data or parent assembly method childWords

 

Guess you like

Origin www.cnblogs.com/huge1122/p/11424224.html