-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mock 添加新配置项不生效 #62
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
我这边模拟article,自己建立了一个新的mock,名字为record,但是重启后,并不生效,提示404.还有什么地方需要修改吗?
api/record.js
`import request from '@/utils/request'
export function fetchList(query) {
return request({
url: '/record/list',
method: 'get',
params: query
})
}`
mock/index/js
`
import Mock from 'mockjs'
import { param2Obj } from '../src/utils'
import user from './user'
import role from './role'
import article from './article'
import record from "./record";
import search from './remote-search'
import test from './test'
const mocks = [
...user,
...role,
...article,
...search,
...record,
...test,
]
`
mock/record.js
`import Mock from 'mockjs'
const List = []
const count = 100
const baseContent = '
I am testing data, I am testing data.
'
const image_uri = 'https://wpimg.wallstcn.com/e4558086-631c-425c-9430-56ffb46e70b3'
for (let i = 0; i < count; i++) {
List.push(Mock.mock({
id: '@increment',
timestamp: +Mock.Random.date('T'),
author: '@FIRST',
reviewer: '@FIRST',
title: '@title(5, 10)',
content_short: 'mock data',
content: baseContent,
forecast: '@float(0, 100, 2, 2)',
importance: '@integer(1, 3)',
'type|1': ['CN', 'US', 'JP', 'EU'],
'status|1': ['published', 'draft', 'deleted'],
display_time: '@datetime',
comment_disabled: true,
pageviews: '@integer(300, 5000)',
image_uri,
platforms: ['a-platform']
}))
}
export default [
{
url: '/record/list',
type: 'get',
response: config => {
const { importance, type, title, page = 1, limit = 20, sort } = config.query
},
]
`
The text was updated successfully, but these errors were encountered: