You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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'
我这边模拟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: