vue-cli3网页显示标题

tech2025-12-31  2

1. package.json 文件 修改 这个文件的 name,名字就会相应的修改。

{ "name": "vuetest", "version": "0.1.0", "private": true, "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", "lint": "vue-cli-service lint" }, ...... }

2. vue.config.js args[0].title = “宝贝商城”; 这是需要显示的名字

module.exports = { // 基本路径 publicPath: '/', // 输出文件目录 outputDir: 'dist', assetsDir: 'static', // 放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录。 devServer: { // host: 'test.cnsuning.com', host: '0.0.0.0', port: 8085, proxy: { '/admin': { target: 'https://api.lovelive.tools', changeOrigin: true, // 请求跳转到 target 的网址,如果是 false ,请求用的还是 host 的网址 pathRewrite: { '^/admin': '/admin' } } } }, //修改或新增html-webpack-plugin的值,在index.html里面能读取htmlWebpackPlugin.options.title chainWebpack: config => { config.plugin('html') .tap(args => { args[0].title = "宝贝商城"; return args; }) }, }
最新回复(0)