mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2025-04-05 06:50:05 +08:00
v4.1.7细节更新
This commit is contained in:
parent
1be73da92a
commit
6f98e8fb0d
4
cfg.ts
4
cfg.ts
@ -135,6 +135,10 @@ const config: AppConfigExport = {
|
||||
find: '@use-images',
|
||||
replacement: path.resolve(__dirname, './src/assets/images'),
|
||||
},
|
||||
{
|
||||
find: '@mock',
|
||||
replacement: path.resolve(__dirname, './mock'),
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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(),
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,10 @@
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
export function array(length: number) {
|
||||
return new Array(length).fill(0)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param pageCurrent 当前页码
|
||||
|
@ -255,7 +255,6 @@ const RayTable = defineComponent({
|
||||
}
|
||||
},
|
||||
render() {
|
||||
console.log(this.action)
|
||||
return (
|
||||
<NCard
|
||||
class="ray-table"
|
||||
|
@ -45,6 +45,9 @@ const MockDemo = defineComponent({
|
||||
run: personFetchRun,
|
||||
} = useHookPlusRequest(getPersonList, {
|
||||
manual: true,
|
||||
onSuccess: (data) => {
|
||||
console.log(data)
|
||||
},
|
||||
})
|
||||
const columns = [
|
||||
{
|
||||
|
@ -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/**/*"
|
||||
]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user