Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

多页面服务端渲染配置vuex问题 #48

Closed
yangzichen987046 opened this issue Nov 28, 2017 · 1 comment
Closed

多页面服务端渲染配置vuex问题 #48

yangzichen987046 opened this issue Nov 28, 2017 · 1 comment

Comments

@yangzichen987046
Copy link

//client.js

import store from '../../../store'

App.render = options => {
  Vue.prototype.$http = require('axios');
  if (options.store) {
    options.store.replaceState(App.data());
  } else if (window.__INITIAL_STATE__) {
    options.data = Object.assign(window.__INITIAL_STATE__, options.data && options.data());
  }

  options.store=store
  const app = new Vue(options);
  app.$mount('#app');
};

computed:{
        loading:function () {
            return this.$store.getters.loading
        }
    },
这时控制器报错“Cannot read property 'getters' of undefined”;但能取到值
=============================================
mounted(){
        console.log(_this.$store.getters.loading)
    }
这样就不报错,也能取到值
求解;是不是配置错了
@ZQun
Copy link

ZQun commented Dec 6, 2017

#41

@hubcarl hubcarl closed this as completed Jan 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants