vue.config.js
module.exports = {
assetsDir:"static",
outputDir:"dist",
indexPath:"index.html",
pages: {
main: {
entry: 'src/main.js',
template: 'public/index.html',
filename: 'index.html',
title: 'index',
chunks: ['chunk-vendors', 'chunk-common', 'main']
},
iframeWin: {
entry: 'src/iframeWin/main.js',
template: 'public/iframeWin.html',
filename: 'iframeWin.html',
title: 'iframe_win',
chunks: ['chunk-vendors', 'chunk-common', 'iframeWin']
}
},
publicPath: './',
chainWebpack: config => {
config.resolve.alias
.set('@', resolve('src'))
.set('src', resolve('src'))
.set('_iframe', resolve('src/iframe/common'))
}
}
public目录:
新建一个iframeWin.html文件
iframeWin.html:
<!DOCTYPE html>
<html lang="cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="./favicon.ico">
<title>IframeWin</title>
</head>
<body>
<div id="IframeWin"></div>
</body>
</html>
src目录下:
创建main.js和App.vue
main.js
import Vue from 'vue'
import App from './App.vue'
if (
process.env.VUE_APP_WEB === 'pc' ||
process.env.VUE_APP_WEB === 'mac_pc'
) {
Vue.prototype.$electron = require('electron')
}
new Vue({
render: h => h(App)
}).$mount('#IframeWin')
最后运行项目
具体方法,请详细了解https://www.kancloud.cn/sllyli/vueproject/1244257