foreword
After the vue project is packaged and released online, an error is reported and doesn't work properly without JavaScript enabled. Please enable it to continue.
the router mode is modified, and then repackaged and uploaded.
1. Modify the router mode
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
const routes = [
{ path: '/', redirect: '/home' },
{
path: '/home',
name: 'Home',
component: () => import('@/views/home/index.vue')
},
]
const router = new VueRouter({
mode: 'hash',
base: process.env.BASE_URL,
routes
})
export default router
Modification method
Just change history to hash