Cannot read properties of undefined (reading ‘use‘)-------编程版本问题

简介: Cannot read properties of undefined (reading ‘use‘)-------编程版本问题

大家好,我是爱你三千遍斯塔克,有时我们在敲代码的时候,可能会碰到这样的问题,Cannot read properties of undefined (reading 'use'),这句代码的意思是无法读取未定义的属性(读取“use”),那么如何解决呢?,这里有一些参考方法,可供大家进行参考,希望对大家有帮助。

2、在vue3的版本,只能安装并使用vue-router4.x

npm i vue-router@next -S

3、Vue-router按需导入方法

4、index.js写法

import { createRouter, createWebHashHistory } from "vue-router"
const router = createRouter({
    history: createWebHashHistory(),
    routes: [
    ]
})
export default router

5、main.js写法

import { createApp } from 'vue'
import App from './App.vue'
import lingyiHeader from '@/components/lingyiHeader.vue'
import router from '@/router/index.js'
import "@/css/common.css"
Vue.component('lingyiHeader', lingyiHeader)
const app = createApp(App)
app.use(router)
app.mount('#app')

6、修正完毕


目录
打赏
0
0
0
0
45
分享
相关文章
成功解决:Cannot read properties of undefined (reading ‘commit‘)
这篇文章提供了解决Vuex中"Cannot read properties of undefined (reading 'commit')"错误的两种方法:检查模板中的数据属性是否存在,以及确保在Vue实例中正确挂载了store对象。
成功解决:Cannot read properties of undefined (reading ‘commit‘)
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
184 0
|
11月前
|
VUE——filemanager-webpack-plugin报错TypeError: Cannot read property 'isFile' of undefined
VUE——filemanager-webpack-plugin报错TypeError: Cannot read property 'isFile' of undefined
238 0
编译第三方前端项目时候出现Syntax Error: TypeError: Cannot set properties of undefined (setting ‘parent‘)
编译第三方前端项目时候出现Syntax Error: TypeError: Cannot set properties of undefined (setting ‘parent‘)
757 0
VUE——Uncaught (in promise) TypeError: Cannot read property '__esModule' of undefined
VUE——Uncaught (in promise) TypeError: Cannot read property '__esModule' of undefined
267 0
TypeError: Cannot set properties of undefined (setting ‘resdata‘),res定义数据出现的问题,定义的方法用this换成that
TypeError: Cannot set properties of undefined (setting ‘resdata‘),res定义数据出现的问题,定义的方法用this换成that
element-ui Cannot read properties of undefined (reading ‘name‘),data中写成集合的形式
element-ui Cannot read properties of undefined (reading ‘name‘),data中写成集合的形式
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等

登录插画

登录以查看您的控制台资源

管理云资源
状态一览
快捷访问