Former-commit-id: b792f259a85060bc427414a1451d7218e8e099f7 [formerly b792f259a85060bc427414a1451d7218e8e099f7 [formerly b792f259a85060bc427414a1451d7218e8e099f7 [formerly b792f259a85060bc427414a1451d7218e8e099f7 [formerly 6a9e02c169cc62ae7f62e1f479aa2fc1eb7759b7 [formerly 7524303cc8515da2de88d785b38eae96a3cc501e]]]]] Former-commit-id: cc0082f2dddee9629e13a66d8458132f4c1529fb Former-commit-id: 1e88751bbe455a8ecf939f0c3745bd6005d3b549 Former-commit-id: 93b5b7cd4d80da8f81c4985e302ba317c3b8ef30 [formerly 6d5ef8bec31f4fa776f9d797f381e57722a0db10] Former-commit-id: e4001eea6899889fe9f50194e23e320c0480dcfb Former-commit-id: 249fd0bd5ccf93dc4a22fc0cc6951dd039151349 Former-commit-id: f35cdabda6780556b92d236ff7e8d359249203c5 Former-commit-id: 4593038573e235b2eb9032d858409e020b7ee667 Former-commit-id: 37b953c1c1657ac5582759f7e8bb63efdb8d90d0
79 lines
1.7 KiB
Vue
79 lines
1.7 KiB
Vue
<template>
|
|
<d2-container :filename="filename" type="card">
|
|
<d2-crud
|
|
v-bind="crud"
|
|
@edit="({ index, row }) => goToEditPage('demo-business-issues-142-edit', row.id)"
|
|
@edit-cache-db="({ index, row }) => goToEditPage('demo-business-issues-142-edit-cache-db', row.id)"
|
|
style="margin: -15px 0;"/>
|
|
<template slot="footer">
|
|
<d2-link-btn
|
|
title="issue #142"
|
|
link="https://github.com/d2-projects/d2-admin/issues/142"/>
|
|
</template>
|
|
</d2-container>
|
|
</template>
|
|
|
|
<script>
|
|
// API
|
|
import {
|
|
fetch
|
|
} from '@/api/demo.business.issues.142'
|
|
|
|
export default {
|
|
data () {
|
|
return {
|
|
filename: __filename,
|
|
crud: {
|
|
columns: [
|
|
{ title: '姓名', key: 'name', width: 100 },
|
|
{ title: '地址', key: 'address' }
|
|
],
|
|
data: [],
|
|
options: {
|
|
border: true,
|
|
size: 'mini'
|
|
},
|
|
rowHandle: {
|
|
align: 'center',
|
|
width: 240,
|
|
custom: [
|
|
{
|
|
text: '无缓存编辑',
|
|
size: 'mini',
|
|
emit: 'edit'
|
|
},
|
|
{
|
|
text: '带缓存编辑 DB',
|
|
size: 'mini',
|
|
emit: 'edit-cache-db'
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
created () {
|
|
this.getTableData()
|
|
},
|
|
methods: {
|
|
// 请求表格数据
|
|
getTableData () {
|
|
fetch()
|
|
.then(res => {
|
|
this.crud.data = res.list
|
|
})
|
|
.catch(err => console.log(err))
|
|
},
|
|
// 跳转到编辑页面
|
|
goToEditPage (name, id) {
|
|
this.$router.push({
|
|
name,
|
|
params: {
|
|
id
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|