首页 > 其他分享 >Vue3 常见错误

Vue3 常见错误

时间:2023-03-02 18:26:27浏览次数:52  
标签:vue 错误 Vue3 常见 createRouter VueRouter import routes router

1.Uncaught SyntaxError: The requested module '/node_modules/.vite/vue-router.js?v=4b09f9b8' does not provide an export named 'default'

【解决】

vue-router的配置文件:

方案一:
import * as VueRouter from 'vue-router'
import routes from './routers'

const router = VueRouter.createRouter({
  history: VueRouter.createWebHashHistory(),
  routes
})

方案二:
import {createRouter, createWebHashHistory} from 'vue-router'
import routes from './routers'

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

 参考:https://blog.csdn.net/Dorothy1224/article/details/120011513 

 

标签:vue,错误,Vue3,常见,createRouter,VueRouter,import,routes,router
From: https://www.cnblogs.com/friend/p/17172899.html

相关文章