d2-crud 自定义操作列

Former-commit-id: 4ef8d5658c9d9d42ba836243ddaa05246068e5c6 [formerly 4ef8d5658c9d9d42ba836243ddaa05246068e5c6 [formerly 4ef8d5658c9d9d42ba836243ddaa05246068e5c6 [formerly 4ef8d5658c9d9d42ba836243ddaa05246068e5c6 [formerly fea6d506b8eea367b160660ae0d9a9ca092db5de [formerly f408b1155caa3e9947904464fcd02c808a4cfc4c]]]]]
Former-commit-id: 861f8d8d90c219a77c697ea6b7dea934f3dc1f3a
Former-commit-id: 390ffaa2967f713d81ecdd8640ea8f6031245af6
Former-commit-id: db9412b70e3ba7ed4088e0ca116229c9581b051e [formerly 3c5eb7c71430a3534822d0335fcc6dbf0dd9c68f]
Former-commit-id: 8d6e9cfff830ef0aecbb7e6922629ec695672307
Former-commit-id: b1ae17e6053d04300c67a10d0ea42fc5ae0f5748
Former-commit-id: cefbf05cb9427468d82f985078880a166a90d99d
Former-commit-id: dcfc4e8711ab7e3169af3c59727346cc41118e77
Former-commit-id: 8425adff3f07ccc49018864127ac8b82082ebd76
This commit is contained in:
孙昊翔
2018-08-28 15:28:15 +08:00
parent 0041a18c64
commit 36258586a0
6 changed files with 163 additions and 2 deletions

View File

@@ -0,0 +1,87 @@
<template>
<d2-container>
<template slot="header">自定义操作列</template>
<d2-crud
:columns="columns"
:data="data"
title="D2 CRUD"
:rowHandle="rowHandle"
@custom-emit-1="handleCustomEvent">
</d2-crud>
<el-card shadow="never" class="d2-mb">
<d2-markdown :source="doc"/>
</el-card>
<el-card shadow="never" class="d2-mb">
<d2-highlight :code="code"/>
</el-card>
<template slot="footer">
<d2-link-btn title="D2 CRUD" link="https://github.com/d2-projects/d2-crud"/>
</template>
</d2-container>
</template>
<script>
import doc from './doc.md'
import code from './code.js'
export default {
data () {
return {
doc,
code,
columns: [
{
title: '日期',
key: 'date'
},
{
title: '姓名',
key: 'name'
},
{
title: '地址',
key: 'address'
}
],
data: [
{
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
},
{
date: '2016-05-04',
name: '王小虎',
address: '上海市普陀区金沙江路 1517 弄'
},
{
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄'
},
{
date: '2016-05-03',
name: '王小虎',
address: '上海市普陀区金沙江路 1516 弄'
}
],
rowHandle: {
custom: [
{
text: '自定义按钮',
type: 'warning',
size: 'small',
emit: 'custom-emit-1'
}
]
}
}
},
methods: {
handleCustomEvent ({index, row}) {
console.log(index)
console.log(row)
}
}
}
</script>