Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

$api问题:在mutation外修改state #4

Open
yiqianglin opened this issue Jan 15, 2019 · 3 comments
Open

$api问题:在mutation外修改state #4

yiqianglin opened this issue Jan 15, 2019 · 3 comments

Comments

@yiqianglin
Copy link

在entry-client.js里面,有给store.state.$api赋值了获取接口的方法,但是这个违反了在mutation外修改state,报错了。
image

image

这要怎么解决呢?

@yiqianglin
Copy link
Author

我这边是开启了严格模式

@lincenying
Copy link
Owner

把vuex的strict模式关了吧...

@yiqianglin
Copy link
Author

嗯,我已经关了。另外,想请教大佬一个问题:现在asyncData里面调用vuex去拉取ssr渲染所需的数据,但是asyncData里面不能访问vue组件实例,所以只能存在store里面。。 这就导致某些很少用到的数据,或者只需要在组件里面使用的低频数据也要存在store里面,这不怎么好。这需要怎么做优化呢

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants