-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 支持在初始化项目时选择vite/webpack/rspack/farm等构建工具 (#154)
* feat: mock-server替换vite-plugin-mock * fix: ts-node启动冲突解决 * fix: mock-server问题修复 * feat: 新增webpack配置文件&新增http-server配置文件&vite打包修复 * fix: 检视意见修改
- Loading branch information
Showing
27 changed files
with
283 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
VITE_CONTEXT=/vue-pro/ | ||
VITE_BASE_API=/api | ||
VITE_SERVER_HOST= http://127.0.0.1:3000 | ||
VITE_MOCK_HOST= http://127.0.0.1:8848 | ||
VITE_USE_MOCK= false | ||
VITE_MOCK_IGNORE= /api/user/userInfo,/api/user/login,/api/user/register,/api/employee/getEmployee | ||
|
||
VITE_MOCK_SERVER_HOST=/mock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
module.exports = { | ||
plugins: ['@vue/babel-plugin-jsx'], | ||
plugins: [ | ||
'@vue/babel-plugin-jsx', | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
VITE_CONTEXT=/vue-pro/ | ||
VITE_BASE_API=/api | ||
VITE_SERVER_HOST= http://127.0.0.1:3000 | ||
VITE_MOCK_HOST= http://127.0.0.1:8848 | ||
VITE_USE_MOCK= false | ||
VITE_MOCK_IGNORE= /api/user/userInfo,/api/user/login,/api/user/register,/api/employee/getEmployee | ||
|
||
VITE_MOCK_SERVER_HOST=/mock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
import axios from 'axios'; | ||
|
||
axios.defaults.timeout = 5000; | ||
// 获取select的option | ||
export function getUserData() { | ||
return axios.get('/api/user/getdata'); | ||
return axios.get(`${import.meta.env.VITE_MOCK_SERVER_HOST}/api/user/getdata`); | ||
} | ||
|
||
export function getUserPractic() { | ||
return axios.get('/api/user/getrpractic'); | ||
return axios.get(`${import.meta.env.VITE_MOCK_SERVER_HOST}/api/user/getrpractic`); | ||
} | ||
|
||
export function getUserTrain() { | ||
return axios.get('/api/user/getrtrain'); | ||
return axios.get(`${import.meta.env.VITE_MOCK_SERVER_HOST}/api/user/getrtrain`); | ||
} | ||
|
||
// 切换数据源 | ||
export function getUserChange(data: string) { | ||
return axios.post('/api/user/getselect', data as any); | ||
return axios.post(`${import.meta.env.VITE_MOCK_SERVER_HOST}/api/user/getselect`, data as any); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,24 @@ | ||
import user from './user'; | ||
import {createMockServer} from '@gaonengwww/mock-server'; | ||
import list from './list'; | ||
import froms from '../views/form/step/mock'; | ||
import profile from './profile'; | ||
import board from './board'; | ||
|
||
const index = [...user, ...list, ...froms, ...profile, ...board]; | ||
let mockData = [] as any | ||
for(let i=0; i<board.length; i+=1){ | ||
mockData.push(board[i]) | ||
} | ||
for(let i=0; i<list.length; i+=1){ | ||
mockData.push(list[i]) | ||
} | ||
for(let i=0; i<froms.length; i+=1){ | ||
mockData.push(froms[i]) | ||
} | ||
for(let i=0; i<profile.length; i+=1){ | ||
mockData.push(profile[i]) | ||
} | ||
|
||
createMockServer({ | ||
mocks: mockData, | ||
}) | ||
|
||
export default index; |
Oops, something went wrong.