💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## 1.路由代码中添加mode:'history' ~~~ const router = new Router({ mode: 'history', //去掉url中的# ~~~ ## 2.在nginx的配置文件.conf中对应的路径下添加:try\_files $uri $uri/ /index.html; ~~~ server { listen 80; server_name my.vue.com; charset utf-8; location / { root /Users/libo/Documents/workspace/Vue-me/my-project/dist; index index.html index.htm index.php; try_files $uri $uri/ /index.html; } location ^~ /ssm_project/ { proxy_pass http://127.0.0.1:8081; proxy_cookie_path /127.0.0.1:8081/ /; proxy_pass_header Set-Cookie; proxy_set_header Host 127.0.0.1:8081; } } ~~~ ## 3.如果项目不在根目录下。例如,路径为 http://www.hahaha.com/static/index,还需要配置 3.1 config/index.js ``` module.exports \= { dev: { // Paths assetsSubDirectory: 'static', assetsPublicPath: '/static/', //为了线上配置的目录,如果线上没有目录前缀则替换为 / proxyTable: { '/api': { target: 'https://xt.yuketang.cn', changeOrigin: true       } }, ``` 3.2 router/index.js ``` var router \= new Router({ mode: 'history', //可以去掉url中的#。但是打包后需要后台配置,否则会404 base: '/static/',//为了线上配置的目录,如果线上没有目录前缀则可以删掉 routes: routerMap, }) ```