Vue报错“ Uncaught TypeError: Cannot read property ‘use‘ of undefined”
Vue报错“ Uncaught TypeError: Cannot read property ‘use‘ of undefined”
Vue报错“ Uncaught TypeError: Cannot read property ‘use‘ of undefined”错误全程Cannot read properties of undefined (reading ‘use’) TypeError
Vue报错“ Uncaught TypeError: Cannot read property ‘use‘ of undefined”
错误全程
Cannot read properties of undefined (reading ‘use’) TypeError: Cannot read properties of undefined (reading ‘use’) at eval (webpack-internal:///./src/store/index.js:6:45) at ./src/store/index.js (http://localhost:8080/js/app.js:96:1) at _
错误分析
这个错误说的是use这个方法没有定义
回到前端代码,发现这里使用了Vue.use,但是上面错误提示里面显示里面没有,原因是因为下面这个写法是Vue2的写法,vue的话需要修改一下。
修改成下面这个格式
代码语言:javascript代码运行次数:0运行复制import { createStore } from 'vuex'
export default createStore({
state: {
}
})
#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格
上传时间: 2025-07-19 10:32:38
推荐阅读
留言与评论(共有 8 条评论) |
本站网友 战神传 | 18分钟前 发表 |
96 | |
本站网友 永州租房信息 | 8分钟前 发表 |
6 | |
本站网友 工业工程论坛 | 12分钟前 发表 |
修改成下面这个格式代码语言:javascript代码运行次数:0运行复制import { createStore } from 'vuex' export default createStore({ state | |
本站网友 酷派f800 | 9分钟前 发表 |
Cannot read property ‘use‘ of undefined”错误全程Cannot read properties of undefined (reading ‘use’) TypeError | |
本站网友 魔域密保卡 | 25分钟前 发表 |
45) at ./src/store/index.js (http | |
本站网友 卡耐基梅隆大学 | 28分钟前 发表 |
{ } })本文参与 腾讯云自媒体同步曝光计划 | |
本站网友 岳阳二手房网 | 3分钟前 发表 |
Cannot read property ‘use‘ of undefined”错误全程Cannot read properties of undefined (reading ‘use’) TypeError |