Former-commit-id: 4c6a0a1f72e1f512b919b934d8483ed430b54766 [formerly f1a4641c19751caddc88308bd8e29fb337f88982] [formerly 4c6a0a1f72e1f512b919b934d8483ed430b54766 [formerly f1a4641c19751caddc88308bd8e29fb337f88982] [formerly 4c6a0a1f72e1f512b919b934d8483ed430b54766 [formerly f1a4641c19751caddc88308bd8e29fb337f88982] [formerly f1a4641c19751caddc88308bd8e29fb337f88982 [formerly 065fde485c713b3ae79131d9da1234dfcbc73cc4 [formerly 470fef55bcb2073a14b6fcc998caabcb83a1097c]]]]] Former-commit-id: c239db922bd8bd06fb68041118a2d25a9c7b475d Former-commit-id: ac5808e62e6ac021da35462b59a04004d62db2dc Former-commit-id: 7890270a60f4db69526403a56cb2dd4feb662e27 [formerly 7b8dd27f1eb72f5e3748d8174fa69c801a73ce1a] Former-commit-id: 027ba79fa86ad1be42f14ef03afebde0cc6ed924 Former-commit-id: 0425a72d2e2b3536fb2ac74199ede23a1e4bea96 Former-commit-id: 96bdce03185ba3befec93d08016d63c7c3c2030a Former-commit-id: e988828be9b03917a9579651a2912d2ed840fb7d Former-commit-id: 07646c36ed91ea4e1efac1bdf1b16b84d8d32eaa
78 lines
1.6 KiB
Vue
78 lines
1.6 KiB
Vue
<template>
|
|
<d2-container 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 {
|
|
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>
|