d2-crud 修改数据

Former-commit-id: 33b78eff73ded5f37e63625cba773140bdcb1160 [formerly 33b78eff73ded5f37e63625cba773140bdcb1160 [formerly 33b78eff73ded5f37e63625cba773140bdcb1160 [formerly 33b78eff73ded5f37e63625cba773140bdcb1160 [formerly ec11f841676b26c24a382cde36b13ad26b6079b2 [formerly ac9073f448ef5e8c50351bbe3542aeda745afee4]]]]]
Former-commit-id: 53b90c5f87c7c3260568721a63264a1c09949fd8
Former-commit-id: b8e27380091427969a613d0d211f9834250a9740
Former-commit-id: 4f57987fe76d14a144228bc84f9c2c0a5a964c31 [formerly 419b150851ece64259038ca9873e2e22298ff639]
Former-commit-id: 5880285fcf0a30f101dc2405d61f681e14f0dc9a
Former-commit-id: a6a0503ba6e4d90e40aaf7d53221b9dd0f42d80a
Former-commit-id: ae0cae44274a1cc0d868c1f61b591c1ecb9417de
Former-commit-id: 752bbb601fdac2f47ca300668d4ea0723e92f1b6
Former-commit-id: c670834cd4fa851ae54c6ac9766ab0850787cc4a
This commit is contained in:
孙昊翔
2018-08-28 14:44:42 +08:00
parent d3b69493c9
commit 5100743edb
6 changed files with 237 additions and 2 deletions

View File

@@ -0,0 +1,108 @@
export default `<template>
<div>
<d2-crud
:columns="columns"
:data="data"
title="D2 CRUD"
:rowHandle="rowHandle"
:form-template="formTemplate"
:form-options="formOptions"
@row-edit="handleRowEdit"
@dialog-cancel="handleDialogCancel"/>
</div>
</template>
<script>
export default {
data () {
return {
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: {
columnHeader: '编辑表格',
edit: {
icon: 'el-icon-edit',
text: '点我进行编辑',
size: 'small',
fixed: 'right'
}
},
formTemplate: {
date: {
title: '日期',
value: ''
},
name: {
title: '姓名',
value: ''
},
address: {
title: '地址',
value: ''
}
},
formOptions: {
labelWidth: '80px',
labelPosition: 'left',
saveLoading: false
}
}
},
methods: {
handleRowEdit ({index, row}, done) {
this.formOptions.saveLoading = true
setTimeout(() => {
console.log(index)
console.log(row)
this.$message({
message: '编辑成功',
type: 'success'
})
done()
this.formOptions.saveLoading = false
}, 300)
},
handleDialogCancel (done) {
this.$message({
message: '取消编辑',
type: 'warning'
})
done()
}
}
}
</script>`