javascript
import { createRouter, createWebHistory } from 'vue-router'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
redirect: '/home',
},
{
path: '/index/home',
component: () => import('../views/index/Home.vue'),
},
{
path: '/home',
component: () => import('../views/home/Index.vue'),
},
{
path: '/me',
component: () => import('../views/me/Index.vue'),
},
],
})
router.beforeEach((to, from) => {
return true
})
export default router
不兼容:
bash
server {
listen 80;
server_name localhost chat.test.com;
#配置根目录
location / {
root /temp/test;
index index.html index.htm;
add_header Content-Security-Policy upgrade-insecure-requests;
}
}
解决方案:
bash
server {
listen 80;
server_name localhost chat.test.com;
#配置根目录
location / {
root /temp/test;
#index index.html index.htm;
try_files $uri $uri/ /index.html;
add_header Content-Security-Policy upgrade-insecure-requests;
}
}
参考链接
https://router.vuejs.org/zh/guide/essentials/history-mode.html#nginx
人工智能学习网站