vue cli3项目打包部署到tomcat服务器运行

步骤:
一、找到文件vue.config.js,没有则自己创建一个


image.png

二、编写vue.config.js的内容


image.png
module.exports = {
  outputDir: 'default',
  assetsDir:'static',
  publicPath:'',
  devServer:{
    host:"127.0.0.1",
    port:8080,
    https:false,
    open:true
  },
  pluginOptions: {
    quasar: {
      importStrategy: 'kebab',
      rtlSupport: true
    }
  },
  transpileDependencies: [
    'quasar'
  ]
}

三、修改路由方式,修改为hash,文件位置自己找,vuecli3中在router.ts文件中


image.png

image.png

四、添加空路由


image.png

五、打包部署
npm run build
六、部署

找到编译好的文件夹,如果作为独立项目,直接拷贝后放到Tomcat里即可,如果是放到另外一个项目中使用,则拷贝到其它项目中去


image.png

七、适配到EOS中使用
7.1、改变原EOS项目中的首页配置
在webapps\default\WEB-INF\web.xml中配置

    
        index.html//原为index.jsp
            coframe/index.jsp
    

7.2、修改原EOS项目中的登录成功的跳转页,也是项目主页
在webapps\default\coframe\auth\index.jsp中配置

<%
    String skin = "default";
    Object userObj = session.getAttribute("userObject");
    if(userObj != null){
        UserObject userObject = (UserObject)userObj;
        if(userObject.getAttributes().get(IConstants.MENU_TYPE) != null){
            skin = (String)userObject.getAttributes().get(IConstants.MENU_TYPE);
        }
    }
    response.sendRedirect(request.getContextPath() + "/#/home");//修改成主页
    /*response.sendRedirect(request.getContextPath() + "/skins/"+skin+"/index.jsp");*/
 %>

你可能感兴趣的:(vue cli3项目打包部署到tomcat服务器运行)