Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vue.js 多个html文件的Vue配置_Vue.js - Fatal编程技术网

Vue.js 多个html文件的Vue配置

Vue.js 多个html文件的Vue配置,vue.js,Vue.js,默认情况下,Vue将生成src/main.js,并将生成脚本注入public/index.html 有没有办法支持多个html文件 示例:我有public/index.html和public/not support.html,每个html还有两个脚本文件,src/main.jsfor和src/not support.jsforpublic/not support.html 构建后,我们将使用插入的单独脚本文件创建dist/index.html和dist/not support.html。如果使用

默认情况下,Vue将生成
src/main.js
,并将生成脚本注入
public/index.html

有没有办法支持多个html文件

示例:我有
public/index.html
public/not support.html
,每个html还有两个脚本文件,
src/main.js
for和
src/not support.js
for
public/not support.html


构建后,我们将使用插入的单独脚本文件创建
dist/index.html
dist/not support.html

如果使用vue cli,可以在vue.config.js文件中设置config以支持多个html文件:

 const config = {
    devServer: {
        open: true,
        disableHostCheck: true,
    },
    pages: {
        index: {
            entry: 'src/index.js',
            template: 'public/index.html',
            filename: 'index.html',
        },
        support: {
            entry: 'src/support.js',
            template: 'public/support.html',
            filename: 'support.html',
        },
    },
    // ...config code
}
module.exports = config
请参阅,以多页模式构建应用程序


谢谢。

如果使用vue cli,可以在vue.config.js文件中设置config以支持多个html文件:

 const config = {
    devServer: {
        open: true,
        disableHostCheck: true,
    },
    pages: {
        index: {
            entry: 'src/index.js',
            template: 'public/index.html',
            filename: 'index.html',
        },
        support: {
            entry: 'src/support.js',
            template: 'public/support.html',
            filename: 'support.html',
        },
    },
    // ...config code
}
module.exports = config
请参阅,以多页模式构建应用程序

谢谢