From c7cb74be3ac6a94fbdcd46a9435b2fb52c483f61 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Fri, 2 Jul 2021 14:01:53 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=89=8D=E7=AB=AF=E5=88=86?= =?UTF-8?q?=E5=BC=80=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/pom.xml | 22 +++++++++++++-- frontend/src/login/login.js | 3 +- frontend/vue.config.js | 56 ++++++++++++++++++++++++------------- 3 files changed, 58 insertions(+), 23 deletions(-) diff --git a/frontend/pom.xml b/frontend/pom.xml index fba5959e96..c6785b7436 100644 --- a/frontend/pom.xml +++ b/frontend/pom.xml @@ -55,12 +55,30 @@ - yarn build + yarn build business yarn - build + build business + + + + yarn build login + + yarn + + + build login + + + + yarn build document + + yarn + + + build document diff --git a/frontend/src/login/login.js b/frontend/src/login/login.js index 33a93e7ed7..10d516cb2f 100644 --- a/frontend/src/login/login.js +++ b/frontend/src/login/login.js @@ -1,5 +1,5 @@ import Vue from 'vue'; -import {Button, Col, Form, FormItem, Input, Row, RadioGroup} from 'element-ui'; +import {Button, Col, Form, FormItem, Input, Row, RadioGroup, Radio} from 'element-ui'; import 'element-ui/lib/theme-chalk/index.css'; import Login from "./Login.vue"; import Ajax from "../common/js/ajax"; @@ -18,6 +18,7 @@ Vue.use(FormItem); Vue.use(Input); Vue.use(Button); Vue.use(RadioGroup); +Vue.use(Radio); Vue.use(Ajax); diff --git a/frontend/vue.config.js b/frontend/vue.config.js index 455ea04148..361a4caee8 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -1,9 +1,41 @@ -const path = require('path') +const path = require('path'); function resolve(dir) { - return path.join(__dirname, dir) + return path.join(__dirname, dir); } +let projectName = process.argv[3]; + +const projects = { + business: { + entry: "src/business/main.js", + template: "src/business/index.html", + filename: "index.html" + }, + login: { + entry: "src/login/login.js", + template: "src/login/login.html", + filename: "login.html" + }, + document: { + entry: "src/document/document.js", + template: "src/document/document.html", + filename: "document.html" + } +}; + +const getPage = function (projectName) { + if (!projectName) { + return projects; + } + return { + [projectName]: projects[projectName] + }; +}; + + +let pages = getPage(projectName); + module.exports = { productionSourceMap: false, devServer: { @@ -17,23 +49,7 @@ module.exports = { }, } }, - pages: { - business: { - entry: "src/business/main.js", - template: "src/business/index.html", - filename: "index.html" - }, - login: { - entry: "src/login/login.js", - template: "src/login/login.html", - filename: "login.html" - }, - document: { - entry: "src/document/document.js", - template: "src/document/document.html", - filename: "document.html" - } - }, + pages: pages, configureWebpack: { devtool: 'source-map', resolve: { @@ -43,6 +59,6 @@ module.exports = { } }, chainWebpack(config) { - config.plugins.delete('prefetch') + config.plugins.delete('prefetch'); } };