鍍金池/ 問(wèn)答/HTML/ VueCli3.0如何構(gòu)建多頁(yè)面?

VueCli3.0如何構(gòu)建多頁(yè)面?

只用Vue做過(guò)單頁(yè)面的開(kāi)發(fā),用多路由實(shí)現(xiàn)的。想知道VueCli3.0怎么實(shí)現(xiàn)多頁(yè)面?中間的引用會(huì)被webpack打包么

回答
編輯回答
編輯回答
解夏

在 webpack 中增加一個(gè)打包入口就好了,webpack 的打包是根據(jù)文件的引用關(guān)系打包的,引用了就會(huì)被打包,你可以再寫(xiě)一個(gè)入口和打包配置,其他的配置可以共享的。看這里

2017年9月1日 08:05
編輯回答
臭榴蓮

根目錄下添加 vue.config.js 寫(xiě)入
module.exports = {

pages: {

    index: {
        // entry for the page
        entry: 'src/login/login.ts',
        // the source template
        // title: "Login page",
        template: 'src/login/login.html',
        // output as dist/index.html
        filename: 'index.html',
    },
    main: {
        entry: 'src/main.ts',
        // title: "main page",
        template: 'src/index.html',
        filename: 'main.html',
        chunks: ['app']
    }
}

}

自行修改url,跟之前2。9版本里面多入口 多html頁(yè)面類似

2017年10月24日 08:16