JavaScript/vue.js/inject

来自康健生活

provide

  export default {
    name: 'UserPage',
    provide () {
      return {
        /* userInfo: () => this.userInfo,
        whetherMyself: () => this.whetherMyself */
        userInfo: this.userInfo,
        whetherMyself: this.whetherMyself,
        myId: this.myId
      };
    },

inject

    inject: ['userInfo', 'whetherMyself'],