vue 建立新的html

63 阅读1分钟
  1. 配置vue.config.js 文件pages

    index: 路由是 ‘/’

    noExamineeWeb: 路由是 ‘/noExamineeWeb’

    在src下建立noExamineeWeb文件夹,创建main.js 里面的App.vue引用其他写好的App.vue

 pages: {
        index: {
            // page 的入口
            entry: 'src/web/main.js',
            // 模板来源
            template: 'public/index.html',
            // 在 dist/index.html 的输出
            filename: 'index.html',
            // 当使用 title 选项时,
            // template 中的 title 标签需要是 <title><%= htmlWebpackPlugin.options.title %></title>
            title: 'xxx',
            // 在这个页面中包含的块,默认情况下会包含
            // 提取出来的通用 chunk 和 vendor chunk。
            chunks: ['chunk-vendors', 'chunk-common', 'index']
        },
	noExamineeWeb: {
            entry: 'src/noExamineeWeb/main.js',
            template: 'public/noExamineeWeb.html',
            filename: 'noExamineeWeb.html',
            title: 'xxx',
            chunks: ['chunk-vendors', 'chunk-common', 'noExamineeWeb']
	},
  1. 修改路由,重新设置base属性

路由的 base = ‘/noExamineeWeb’