Vue adds the global component top, to App.vue, so how does the top component communicate with the routing page in < router-view > and pass a value

<template>
  <div id="app">
    <top-view/>
    <router-view/>
    <footer-view/>
  </div>
</template>

<script>

import top from "@/view/Top"
import footer from "@/view/Footer"

export default{
  name: "App",
  components:{
      TopView:top,
      FooterView:footer,
  }
}
</script>
<style lang="scss">
    @import "./src/assets/sass/style.scss";
</style>
Jun.18,2021

this is not a parent-child component. It is better to use eventbus and state management vuex .


  1. vuex
  2. bus bus
Menu