From 76bf4a96d1e71d8463433276841edb5f347611cf Mon Sep 17 00:00:00 2001 From: liyang <1711467488@qq.com> Date: Fri, 14 Dec 2018 10:42:43 +0800 Subject: [PATCH] =?UTF-8?q?issue=E6=BC=94=E7=A4=BA=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=BD=BF=E7=94=A8mock=E6=95=B0=E6=8D=AE=E5=8A=A0=E8=BD=BDlist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/demo.business.issues.142.js | 9 ++++++- src/mock/api/demo.business.issues.142.js | 21 +++++++++++++--- src/pages/demo/business/issues/142/index.vue | 25 +++++++++++++------ .../demo/business/issues/142/mixins/index.js | 6 +++-- 4 files changed, 47 insertions(+), 14 deletions(-) diff --git a/src/api/demo.business.issues.142.js b/src/api/demo.business.issues.142.js index 0e0f2bd83..279e878b5 100644 --- a/src/api/demo.business.issues.142.js +++ b/src/api/demo.business.issues.142.js @@ -1,6 +1,13 @@ import request from '@/plugin/axios' -export function get (id) { +export function fetch () { + return request({ + url: '/demo/business/issues/142/fetch', + method: 'get' + }) +} + +export function detail (id) { return request({ url: '/demo/business/issues/142/detail', method: 'get', diff --git a/src/mock/api/demo.business.issues.142.js b/src/mock/api/demo.business.issues.142.js index 13920c135..5f8fb6ec8 100644 --- a/src/mock/api/demo.business.issues.142.js +++ b/src/mock/api/demo.business.issues.142.js @@ -1,11 +1,24 @@ const db = [ - { id: '1', name: '王小虎1', address: '上海市普陀区金沙江路 1518 弄' }, - { id: '2', name: '王小虎2', address: '上海市普陀区金沙江路 1517 弄' }, - { id: '3', name: '王小虎3', address: '上海市普陀区金沙江路 1519 弄' }, - { id: '4', name: '王小虎4', address: '上海市普陀区金沙江路 1516 弄' } + { id: '1', name: '用户 1', address: '上海市普陀区金沙江路 1518 弄' }, + { id: '2', name: '用户 2', address: '上海市普陀区金沙江路 1517 弄' }, + { id: '3', name: '用户 3', address: '上海市普陀区金沙江路 1519 弄' }, + { id: '4', name: '用户 4', address: '上海市普陀区金沙江路 1516 弄' } ] export default [ + { + path: '/api/demo/business/issues/142/fetch.*', + method: 'get', + handle () { + return { + code: 0, + msg: '获取数据成功', + data: { + list: db + } + } + } + }, { path: '/api/demo/business/issues/142/detail.*', method: 'get', diff --git a/src/pages/demo/business/issues/142/index.vue b/src/pages/demo/business/issues/142/index.vue index dbcedef46..b8f777b1b 100644 --- a/src/pages/demo/business/issues/142/index.vue +++ b/src/pages/demo/business/issues/142/index.vue @@ -14,27 +14,28 @@