Skip to content

Commit

Permalink
run
Browse files Browse the repository at this point in the history
  • Loading branch information
hzsrc committed Jul 14, 2024
1 parent 0e9cd50 commit 77d2140
Show file tree
Hide file tree
Showing 14 changed files with 759 additions and 186 deletions.
13 changes: 8 additions & 5 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ module.exports = {
{
corejs: 3,
useBuiltIns: 'usage',
modules: false
modules: false,
//开发环境,不做es6转换,以便于调试
targets: process.env.NODE_ENV === 'development' ? 'fully supports es6' : 'browserslist config'
}
]
],
'@vue/babel-preset-jsx', // for babel7
],
plugins: [
'@babel/plugin-syntax-dynamic-import',
//'@babel/plugin-syntax-dynamic-import',
//'@babel/plugin-transform-runtime', //用了useBuiltIns不需要它
['@babel/plugin-proposal-class-properties', { loose: true }],
'@vue/babel-plugin-transform-vue-jsx',
//['@babel/plugin-proposal-class-properties'],
//babel7不用这个:'@vue/babel-plugin-transform-vue-jsx',
[
'babel-plugin-component',
{
Expand Down
7 changes: 6 additions & 1 deletion config/app-config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
var getElementUISeries = require('webpack-theme-color-replacer/forElementUI/getElementUISeries')

module.exports = {
LOGIN_PATH: './',
title: 'vue + webpack4 + element-ui脚手架项目',
description: 'vue + webpack4 + element-ui脚手架项目',

themeColor: '#f67a17'
themeColor: '#f67a17',
otherColors: ['#10213a', '#fefeff'], //titleBg、titleFg
getThemeColors: function (primaryColor, otherColors) {
return getElementUISeries(primaryColor, otherColors);//element-ui主色系列
}
}
20 changes: 19 additions & 1 deletion mock/mock-config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
var frontFiles = /^(\/\w+|)\/(h5\/.+|$|\w+\.html|favicon\.ico|__webpack_hmr|.+hot-update.+)/

const config = {
mockEnabled: true,
mockPath: ['root', 'root-old'], //模拟文件根目录
proxyTarget: 'http://aaa.bbb.com', //后台接口服务地址(代理目标),为空表示不代理
proxyTarget(uri) { //后台接口服务地址(代理目标),为空表示不代理
var frontPart = frontFiles.exec(uri.pathname)
if (frontPart) {
if (frontPart && frontPart[1]) { //url带了虚拟目录,转前端时不要虚拟目录
uri.pathname = frontPart[2]
uri.setChanged();
}
//前端页面,到h5
return 'http://localhost:8090'
}
//非前端页面(ajax和v9页面相关)
return 'http://localhost:8080' //.后端
},
isHttps: false, //是否https
port: 8087, //端口
proxyOptions: {
changeOrigin: true, //支持用IP远程访问
},
checkPath: function (urlPath) { //urlPath校验函数,返回true表示需要进行mock处理,为false直接走代理
return true
},
Expand All @@ -22,5 +39,6 @@ const config = {
// genClientJs: '../src/js/mockClient.js', // 生成mockClient.js
samePreview: false, // true - mock预览时disabled开关也生效(默认false,预览时忽略所有开关)
logData: true, // mock预览时打印模拟数据
title: 'My App'
}
module.exports = config;
2 changes: 1 addition & 1 deletion mock/root/.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//本文件模拟根目录的响应数据(类似index.html的作用)
var fs = require('fs')
module.exports = {
disabled: 0,
disabled: 1,
headers: {
'Content-Type': 'text/html'
},
Expand Down
Loading

0 comments on commit 77d2140

Please sign in to comment.