1 Star 0 Fork 1

ittahac/open-admin-pro

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vue.config.js 4.13 KB
一键复制 编辑 原始数据 按行查看 历史
ittahac 提交于 2019-12-09 09:25 . 测试提交一下
const path = require('path')
const webpack = require('webpack')
const ThemeColorReplacer = require('webpack-theme-color-replacer')
const forElementUI = require('webpack-theme-color-replacer/forElementUI')
function resolve (dir) {
return path.join(__dirname, dir)
}
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
// Ignore all locale files of moment.js
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
// 生成仅包含颜色的替换样式(主题色等)
// TODO 需要增加根据环境不开启主题需求
new ThemeColorReplacer({
fileName: 'css/theme-colors-[contenthash:8].css',
matchColors: forElementUI.getElementUISeries('#2d8cf0').concat('#fff'), // 主色系列
// 改变样式选择器,解决样式覆盖问题
changeSelector (selector) {
switch (selector) {
case '.ivu-calendar-today .ivu-calendar-date':
return ':not(.ivu-calendar-selected-date):not(.ivu-calendar-selected-day)' + selector
case '.ivu-btn:focus,.ivu-btn:hover':
return '.ivu-btn:focus:not(.ivu-btn-primary),.ivu-btn:hover:not(.ivu-btn-primary)'
case '.ivu-steps-item-process .ivu-steps-item-icon > .ivu-steps-icon':
return ':not(.ivu-steps-item-process)' + selector
case '.ivu-btn.active,.ivu-btn:active':
return '.ivu-btn.active:not(.ivu-btn-primary),.ivu-btn:active:not(.ivu-btn-primary)'
case '.ivu-menu-horizontal>.ivu-menu-item-active,.ivu-menu-horizontal>.ivu-menu-item-open,.ivu-menu-horizontal>.ivu-menu-item-selected,.ivu-menu-horizontal>.ivu-menu-item:hover,.ivu-menu-horizontal>.ivu-menu-submenu-active,.ivu-menu-horizontal>.ivu-menu-submenu-open,.ivu-menu-horizontal>.ivu-menu-submenu-selected,.ivu-menu-horizontal>.ivu-menu-submenu:hover':
case '.ivu-menu-horizontal > .ivu-menu-item-active,.ivu-menu-horizontal > .ivu-menu-item-open,.ivu-menu-horizontal > .ivu-menu-item-selected,.ivu-menu-horizontal > .ivu-menu-item:hover,.ivu-menu-horizontal > .ivu-menu-submenu-active,.ivu-menu-horizontal > .ivu-menu-submenu-open,.ivu-menu-horizontal > .ivu-menu-submenu-selected,.ivu-menu-horizontal > .ivu-menu-submenu:hover':
return '.ivu-menu-horizontal > .ivu-menu-item-active,.ivu-menu-horizontal > .ivu-menu-item-open,.ivu-menu-horizontal > .ivu-menu-item-selected,.ivu-menu-horizontal:not(.ivu-menu-dark) > .ivu-menu-item:hover,.ivu-menu-horizontal > .ivu-menu-submenu-active,.ivu-menu-horizontal > .ivu-menu-submenu-open,.ivu-menu-horizontal:not(.ivu-menu-dark) > .ivu-menu-submenu-selected,.ivu-menu-horizontal:not(.ivu-menu-dark) > .ivu-menu-submenu:hover'
case '.ivu-menu-horizontal > .ivu-menu-item-selected > a':
return ':not(.ivu-menu-horizontal)' + selector
case '.ivu-menu-horizontal > .ivu-menu-item > a:hover':
return ':not(.ivu-menu-horizontal)' + selector
default :
return selector
}
}
})
]
},
chainWebpack: (config) => {
config.resolve.alias
.set('@', resolve('src')) // key,value自行定义,比如.set('@@', resolve('src/components'))
.set('_c', resolve('src/components'))
const svgRule = config.module.rule('svg')
svgRule.uses.clear()
svgRule
.oneOf('inline')
.resourceQuery(/inline/)
.use('vue-svg-icon-loader')
.loader('vue-svg-icon-loader')
.end()
.end()
.oneOf('external')
.use('file-loader')
.loader('file-loader')
.options({
name: 'assets/[name].[hash:8].[ext]'
})
},
css: {
loaderOptions: {
less: {
javascriptEnabled: true
}
}
},
devServer: {
// development server port 8000
port: 8000,
proxy: {
'/api/': {
target: 'http://10.150.193.111:8888/',
// target: 'http://192.168.3.17:8888',
ws: true,
changeOrigin: true,
pathRewrite: {
'^/api': '/',
}
}
}
},
// disable source map in production
productionSourceMap: false,
lintOnSave: false,
// babel-loader no-ignore node_modules/*
transpileDependencies: []
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/chinaMic/open-admin-pro.git
[email protected]:chinaMic/open-admin-pro.git
chinaMic
open-admin-pro
open-admin-pro
master

搜索帮助