首页 > Web开发 > 详细

vue-cli4修改index.html中的title

时间:2020-07-18 22:11:13      阅读:533      评论:0      收藏:0      [点我收藏+]

由于vue-cli4的index.html的title是在webpack中定义的,如下

<title><%= htmlWebpackPlugin.options.title %></title>

修改方法:
在vue.config.js中设置

module.exports = {
    //修改或新增html-webpack-plugin的值,在index.html里面能读取htmlWebpackPlugin.options.title
    chainWebpack: config =>{
      config.plugin(‘html‘)
        .tap(args => {
          args[0].title = "宝贝商城";
          return args;
        })
    }
  };

想看更多的博客,请到该 博客

vue-cli4修改index.html中的title

原文:https://www.cnblogs.com/blogwxb/p/13336636.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!