Modification of vue2 global variable [fragrant invitation code: 15MNA6]

global.js

export default {
  name: "Who",
  sex: "Male",
  setname (newName) {
    this.name = newName
    console.log("")
  }
}

main.js

import global_ from "./api/global"

Vue.prototype.GLOBAL = global_

Page 1

 created () {
    this.GLOBAL.setname("")
  },

Page 2

created () {
  console.log(this.GLOBAL.name)
}

the problem now is that the value of global does change when the page 1created, but it changes back when it is routed to page 2.
if the route jumps, can the value be passed only through route or local localstorage?

Mar.28,2021

vuex, bus

Menu