-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c9c5ca9
commit 9bc682d
Showing
18 changed files
with
363 additions
and
83 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 |
---|---|---|
|
@@ -7,7 +7,6 @@ lib | |
.vscode | ||
.idea | ||
/dist/ | ||
/mock/ | ||
/public | ||
/docs | ||
.vscode | ||
|
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,9 @@ | ||
import { viteMockServe } from 'vite-plugin-mock'; | ||
|
||
export default viteMockServe({ | ||
mockPath: 'mock', | ||
injectCode: ` | ||
import { setupMockServer } from '../mock'; | ||
setupMockServer(); | ||
` | ||
}); |
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,7 +1,6 @@ | ||
import { visualizer } from 'rollup-plugin-visualizer'; | ||
|
||
export default visualizer({ | ||
open: true, | ||
gzipSize: true, | ||
brotliSize: true | ||
}); |
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,16 @@ | ||
import type { MockMethod } from 'vite-plugin-mock'; | ||
import type { BackendServiceResult } from '@/interface'; | ||
|
||
export default [ | ||
{ | ||
url: '/api/getUser', | ||
method: 'get', | ||
response: (): BackendServiceResult => { | ||
return { | ||
code: 200, | ||
message: 'ok', | ||
data: '测试mock数据' | ||
}; | ||
} | ||
} | ||
] as MockMethod[]; |
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,3 @@ | ||
import auth from './auth'; | ||
|
||
export default [...auth]; |
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,6 @@ | ||
import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer'; | ||
import api from './api'; | ||
|
||
export function setupMockServer() { | ||
createProdMockServer(api); | ||
} |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 @@ | ||
import { consoleLog } from '@/utils'; | ||
import { mockRequest } from '../request'; | ||
|
||
/** 测试mock数据 */ | ||
export async function fetchTestMock() { | ||
const { data } = await mockRequest.get('/api/getUser'); | ||
consoleLog('data: ', data); | ||
} |
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 +1,2 @@ | ||
export * from './demo'; | ||
export * from './auth'; |
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,16 @@ | ||
/* eslint-disable no-console */ | ||
|
||
/** 打印log */ | ||
export function consoleLog(message?: any, ...optionalParams: any[]) { | ||
console.log(message, ...optionalParams); | ||
} | ||
|
||
/** 打印警告 */ | ||
export function consoleWarn(message?: any, ...optionalParams: any[]) { | ||
console.warn(message, ...optionalParams); | ||
} | ||
|
||
/** 打印错误 */ | ||
export function consoleError(message?: any, ...optionalParams: any[]) { | ||
console.error(message, ...optionalParams); | ||
} |
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 was deleted.
Oops, something went wrong.
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