美文网首页
vue cli3项目打包部署到tomcat服务器运行

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

作者: 笑才 | 来源:发表于2021-01-09 11:24 被阅读0次

    步骤:
    一、找到文件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中配置

        <welcome-file-list>
            <welcome-file>index.html</welcome-file>//原为index.jsp
                <welcome-file>coframe/index.jsp</welcome-file>
        </welcome-file-list>
    

    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服务器运行

          本文链接:https://www.haomeiwen.com/subject/jjfnmhtx.html