如何为Vue 2,7添加Vuex 3?

问题描述 投票:0回答:0

当我运行:yarn create nuxt-app 我在 package.json 中看到我有:

"dependencies": {
   "nuxt": "^2.15.8",
   "vue": "^2.7.10",
},

我需要使用Vuex。 对于这个环境,我必须使用Vuex 3。 所以我按照文档所说的去做:

yarn add vuex
。但这总是会导致安装 vuex 4:

"dependencies": {
   "nuxt": "^2.15.8",
   "vue": "^2.7.10",
   "vuex": "^4.1.0"
},

但这会导致各种问题,因为 vuex 4 仅适用于Vue 3。

运行

yarn add vuex
的结果与运行
yarn add vuex@next --save
相同。

如何在我的 Nuxt 项目中安装 Vuex 3 for Vue 2.7 ?我错过了什么?

vue.js vuejs2 nuxt.js vuex
© www.soinside.com 2019 - 2024. All rights reserved.