https://github.com/nuysoft/Mock/wiki/Syntax-Specification
A Vue.js project
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
** // main.js
** require('./mock');
在该文件中,我们可以按照index注册服务的格式来写我们的mock
** let demoList = {
** status: 200,
** message: 'success',
** data: {
** total: 100,
** 'rows|10': [{
** id: '@guid', 随机id
** name: '@cname', 随机中文名
** 'age|20-30': 23, 20-30之内的数字
** 'job|1': ['前端工程师', '后端工程师', 'UI工程师', '需求工程师']
**}]
** }
** };
** export default {
** 'get|/parameter/query': demoList
** }
For a detailed explanation on how things work, check out the guide and docs for vue-loader.