【问题标题】:How to access other pages in a multiple pages configuration with vue.js?如何使用 vue.js 访问多页面配置中的其他页面?
【发布时间】:2020-05-29 08:23:50
【问题描述】:

我在关注这个帖子:multiple pages in Vue.js CLI

我很高兴现在有多个页面...但是,我怎样才能访问它?从 URL:http://localhost:8080/,我可以在最后设置我想要的所有内容,但它一直显示相同的页面。

这是我的 vue.config.js :

module.exports = {
    lintOnSave: false,
    pages: {
        index: {
            entry: './src/pages/Index.js',
            template: './public/index.html',
            filename: 'index.html',
            title: 'Accueil',
            chunks: [
                'chunk-vendors',
                'chunk-common',
                'index'
            ]
        },
        test: {
            entry: './src/pages/Test.js',
            template: './public/index.html',
            filename: 'index.html',
            title: 'Test Page',
            chunks: [
                'chunk-vendors',
                'chunk-common',
                'index'
            ]
        }
    }
};

我重新加载了服务器,没有错误,一切看起来都很好。我想我只是在某个地方漏掉了一些东西。

【问题讨论】:

    标签: javascript vue.js


    【解决方案1】:

    我发现了问题,这是正确的解决方案:

    module.exports = {
        lintOnSave: false,
        pages: {
            index: {
                entry: './src/pages/Index.js',
                template: './public/index.html',
                filename: 'index.html',
                title: 'Accueil',
                chunks: [
                    'chunk-vendors',
                    'chunk-common',
                    'index'
                ]
            },
            sample: {
                entry: './src/pages/Sample.js',
                template: './public/index.html',
                filename: 'sample.html',
                title: 'Sample page',
                chunks: [
                    'chunk-vendors',
                    'chunk-common',
                    'sample'
                ]
            }
        }
    };
    

    我用相同的“文件名”值命名页面。然后,“块”必须包含页面的名称(我猜)但现在它可以工作了!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-24
      • 2012-09-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多