v4.1.7细节更新

This commit is contained in:
XiaoDaiGua-Ray 2023-08-14 17:42:05 +08:00
parent 1be73da92a
commit 6f98e8fb0d
7 changed files with 37 additions and 17 deletions

4
cfg.ts
View File

@ -135,6 +135,10 @@ const config: AppConfigExport = {
find: '@use-images',
replacement: path.resolve(__dirname, './src/assets/images'),
},
{
find: '@mock',
replacement: path.resolve(__dirname, './mock'),
},
],
}

View File

@ -1,26 +1,17 @@
import { defineMock } from 'vite-plugin-mock-dev-server'
import { pagination, stringify, response, array } from '@mock/shared/utils'
import { tableMock } from '@mock/shared/database'
import Mock from 'mockjs'
import { pagination, stringify, response } from '../shared/utils'
import { array } from '../shared/database'
export const getPersonList = defineMock({
url: '/api/list',
method: 'GET',
delay: 500,
response: (req, res) => {
const person = () => ({
id: Mock.Random.guid(),
address: Mock.Random.county(true),
email: Mock.Random.email(),
name: Mock.Random.cname(),
age: Mock.Random.integer(18, 60),
createDate: Mock.Random.date(),
})
const {
query: { page, pageSize, email },
} = req
let list = array(100).map(() => person())
let list = array(100).map(() => tableMock())
let length = list.length
if (!page || !pageSize) {

View File

@ -9,6 +9,22 @@
* @remark
*/
export function array(length: number) {
return new Array(length).fill(0)
import Mock from 'mockjs'
/**
*
* @param option
*
*
*/
export function tableMock(option?: object) {
return {
...option,
id: Mock.Random.guid(),
address: Mock.Random.county(true),
email: Mock.Random.email(),
name: Mock.Random.cname(),
age: Mock.Random.integer(18, 60),
createDate: Mock.Random.date(),
}
}

View File

@ -11,6 +11,10 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
export function array(length: number) {
return new Array(length).fill(0)
}
/**
*
* @param pageCurrent

View File

@ -255,7 +255,6 @@ const RayTable = defineComponent({
}
},
render() {
console.log(this.action)
return (
<NCard
class="ray-table"

View File

@ -45,6 +45,9 @@ const MockDemo = defineComponent({
run: personFetchRun,
} = useHookPlusRequest(getPersonList, {
manual: true,
onSuccess: (data) => {
console.log(data)
},
})
const columns = [
{

View File

@ -23,7 +23,9 @@
"@use-api/*": ["src/axios/api/*"],
"@use-images": ["src/assets/images"],
"@use-images/*": ["src/assets/images"],
"@use-micro/*": ["src/micro/*"]
"@use-micro/*": ["src/micro/*"],
"@mock/*": ["mock/*"],
"@mock": ["mock/*"]
},
"suppressImplicitAnyIndexErrors": true,
"typeRoots": ["./src/types/app.d.ts", "./src/types/global.d.ts"],
@ -38,6 +40,7 @@
"package.json",
"vite-env.d.ts",
"./unplugin/**/*",
"src/**/*"
"src/**/*",
"mock/**/*"
]
}