We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
index.js (controller)
... // 页面渲染时使用的参数 const params = { logo: 'test', //some.... }; await this.ctx.render('admin/index.js', params); ...
index.vue(admin/index.js)
... export default { router, store, created() { // 获取到的值为undefined console.log(this.logo) }, } ...
当页面中同时使用router和store时,vue对象无法获取到ctx.render中设置的参数。
按照上面的代码,我想在vue中使用this.logo的参数。实际情况是this.logo的参数在浏览器中打印为undefined。
我的解决方案是将router写在另外一个component中,然后再引用。但是,之前版本(easywebpack-vue 3.x)不存在这个问题。
目前使用的版本依赖
"dependencies": { // some... "egg": "^2.1.0", "egg-view-vue-ssr": "^3.0.5", "vue": "^2.5.0", "vue-router": "^3.0.1", "vuex": "^3.0.1", "vuex-router-sync": "^5.0.0", }, "devDependencies": { // some... "easywebpack-cli": "^4.0.0", "easywebpack-vue": "^4.2.0", "egg-logview": "^1.0.0", "egg-webpack": "^4.4.1", "egg-webpack-vue": "^2.0.0", }
The text was updated successfully, but these errors were encountered:
this.$store.state.logo 试试
Sorry, something went wrong.
#120
No branches or pull requests
index.js (controller)
index.vue(admin/index.js)
当页面中同时使用router和store时,vue对象无法获取到ctx.render中设置的参数。
按照上面的代码,我想在vue中使用this.logo的参数。实际情况是this.logo的参数在浏览器中打印为undefined。
我的解决方案是将router写在另外一个component中,然后再引用。但是,之前版本(easywebpack-vue 3.x)不存在这个问题。
目前使用的版本依赖
The text was updated successfully, but these errors were encountered: