错误一:
[VueError]Error: [vuex] do not mutate vuex store
state outside mutation handlers.
错误二:
computed value is readonly
以下情况就会报错,去掉任意一个useFetch 就能解决问题
同一个页面
组件一
useFetch(async () => {
store.commit('wish/set', ['data', {name: '张三'}])
})
组件二
const data = computed(() => store.state.wish.data)
useFetch(async () => {
....
})
retrun {
data
}