issue演示页面使用mock数据加载list
Former-commit-id: 08b187b2764b92959111ef8c728f0bd7a5d501f2 [formerly 08b187b2764b92959111ef8c728f0bd7a5d501f2 [formerly 08b187b2764b92959111ef8c728f0bd7a5d501f2 [formerly 08b187b2764b92959111ef8c728f0bd7a5d501f2 [formerly d59731e1bb8d0baa4b90d8e9c73f44c7f8ac4441 [formerly fc1e18dc44bd90924c6c02e4669197fd8502d18d]]]]] Former-commit-id: 91557cbbc0e34412d129706b10375676a22562c2 Former-commit-id: 0905517334520418154b45a950ffaefb71171dbf Former-commit-id: e71ba11d0f8ad3418af5d3b2c464b9a3a1042598 [formerly 8a7a02d1fd02f1b7828cdd0b63455aa7e51d408a] Former-commit-id: 75e9f65dd0f5a99d6d9581b72f25d8429ebcee31 Former-commit-id: c63405062ebccba334a6ac9e1135364d297bdd0b Former-commit-id: 3ddcada8fe0fb48e897c03c2e0f72da63bc17107 Former-commit-id: de1a37a99bb6b3f594b042bab01bb3ba5778cee2 Former-commit-id: bf4b3f3e405a31d9542c59f18784a8e080a9e31b
This commit is contained in:
@@ -1,6 +1,13 @@
|
|||||||
import request from '@/plugin/axios'
|
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({
|
return request({
|
||||||
url: '/demo/business/issues/142/detail',
|
url: '/demo/business/issues/142/detail',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
|||||||
@@ -1,11 +1,24 @@
|
|||||||
const db = [
|
const db = [
|
||||||
{ id: '1', name: '王小虎1', address: '上海市普陀区金沙江路 1518 弄' },
|
{ id: '1', name: '用户 1', address: '上海市普陀区金沙江路 1518 弄' },
|
||||||
{ id: '2', name: '王小虎2', address: '上海市普陀区金沙江路 1517 弄' },
|
{ id: '2', name: '用户 2', address: '上海市普陀区金沙江路 1517 弄' },
|
||||||
{ id: '3', name: '王小虎3', address: '上海市普陀区金沙江路 1519 弄' },
|
{ id: '3', name: '用户 3', address: '上海市普陀区金沙江路 1519 弄' },
|
||||||
{ id: '4', name: '王小虎4', address: '上海市普陀区金沙江路 1516 弄' }
|
{ id: '4', name: '用户 4', address: '上海市普陀区金沙江路 1516 弄' }
|
||||||
]
|
]
|
||||||
|
|
||||||
export default [
|
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.*',
|
path: '/api/demo/business/issues/142/detail.*',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
|||||||
@@ -14,27 +14,28 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
// API
|
||||||
|
import {
|
||||||
|
fetch
|
||||||
|
} from '@/api/demo.business.issues.142'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
filename: __filename,
|
filename: __filename,
|
||||||
crud: {
|
crud: {
|
||||||
columns: [
|
columns: [
|
||||||
{ title: '姓名', key: 'name' },
|
{ title: '姓名', key: 'name', width: 100 },
|
||||||
{ title: '地址', key: 'address' }
|
{ title: '地址', key: 'address' }
|
||||||
],
|
],
|
||||||
data: [
|
data: [],
|
||||||
{ id: '1', name: '王小虎1', address: '上海市普陀区金沙江路 1518 弄' },
|
|
||||||
{ id: '2', name: '王小虎2', address: '上海市普陀区金沙江路 1517 弄' },
|
|
||||||
{ id: '3', name: '王小虎3', address: '上海市普陀区金沙江路 1519 弄' },
|
|
||||||
{ id: '4', name: '王小虎4', address: '上海市普陀区金沙江路 1516 弄' }
|
|
||||||
],
|
|
||||||
options: {
|
options: {
|
||||||
border: true,
|
border: true,
|
||||||
size: 'mini'
|
size: 'mini'
|
||||||
},
|
},
|
||||||
rowHandle: {
|
rowHandle: {
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
width: 240,
|
||||||
custom: [
|
custom: [
|
||||||
{
|
{
|
||||||
text: '无缓存编辑',
|
text: '无缓存编辑',
|
||||||
@@ -51,7 +52,17 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created () {
|
||||||
|
this.getTableData()
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 请求表格数据
|
||||||
|
getTableData () {
|
||||||
|
fetch()
|
||||||
|
.then(res => this.crud.data = res.list)
|
||||||
|
.catch(err => console.log(err))
|
||||||
|
},
|
||||||
|
// 跳转到编辑页面
|
||||||
goToEditPage (name, id) {
|
goToEditPage (name, id) {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name,
|
name,
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { get } from '@api/demo.business.issues.142'
|
import {
|
||||||
|
detail
|
||||||
|
} from '@api/demo.business.issues.142'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@@ -29,7 +31,7 @@ export default {
|
|||||||
// 重置表单
|
// 重置表单
|
||||||
this.resetFormData()
|
this.resetFormData()
|
||||||
// 请求数据
|
// 请求数据
|
||||||
get(id)
|
detail(id)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const { name, address } = res
|
const { name, address } = res
|
||||||
this.form = { name, address }
|
this.form = { name, address }
|
||||||
|
|||||||
Reference in New Issue
Block a user