1.webpack打包时修改:

config/index.js 配置assetsPublicPath:'./' (也可以加项目名称)

 

对于css里面的图片,webpack会打包读取不到:打开build / utils.js:加入publicPath:'../ ../'

 

linux:vue在tomcat的部署

 

2.在路由里面加入:mode:'history'和base:'mynote'

linux:vue在tomcat的部署

 

3.针对history模式路由刷新页面404问题:创建一个WEB-INF/web.xml文件:

linux:vue在tomcat的部署

 

web.xml:

 

<?xml version="1.0" encoding="UTF-8"?>

<web-app metadata-complete="true" version="3.1" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee">

<display-name>Router for Tomcat</display-name>

<error-page>

<error-code>404</error-code>

<location>/index.html</location>

</error-page>

</web-app>

相关文章:

  • 2021-12-09
  • 2021-09-12
  • 2022-01-08
  • 2021-09-27
  • 2021-09-05
  • 2021-10-16
  • 2022-12-23
猜你喜欢
  • 2021-11-05
  • 2021-04-10
  • 2021-05-23
  • 2021-12-21
  • 2021-04-05
  • 2022-01-04
  • 2021-09-16
相关资源
相似解决方案