vue 域名定义引用已经定义的
`${direct.sitv1}/path`
抖动
currenMethod: debounce(function(){
action;
},100);
import Mock from 'mockjs';
import {getQueryParams} from '#/utils/common';
const initData = Mock.mock({
'data|200':[{
'id|+1':10000,
code:'@id',
road:'@country(true)',
time:'@date("yyyy-MM-dd")',
isExclusive:'@boolean',
amount:'@natural(6)',
agencyNo:'@integer(60,100)',
mobilePhone:/^1[34578]\d{9}$/,
'agencyLevel|1-10':1
}],
'data|201':[{
'id|+1':10000,
code:'@id',
road:'@country(true)',
time:'@date("yyyy-MM-dd")',
isExclusive:'@boolean',
'note':'@csentence(2)',
descrip:'@cparagrahp(1)',
pname:'@ctitle(2,4)',
amount:'@natural(6)',
agencyNo:'@integer(60,100)',
mobilePhone:/^1[34578]\d{9}$/,
'agencyLevel|1-10':1
}]
...
})
const demo = [
{
type:'get',
path:'/mock/test',
data:function(req){
const params = getQueryParams(req.utl);
return Mock.mock({
code:200,
message:'success',
rows:Arrays.from(initData.data).splice((params.pageNum-1)*params.pageSize,params.pageSize),
data:{
pageNum:1,
list:initData.data.splice(0,10),
total:initData.data.length,
}
})
}
}
]
export default demo
Mock.mock(RegExp('employee/change/list'),'get',option=>{
return {}
});
标签:vue,initData,params,mock,data,id,Mock From: https://www.cnblogs.com/sxsheng/p/16887570.html