Merge branch 'hotfix/d2_crud_example'

Former-commit-id: e5d114a5c7382d8ba36bb6b7572a1fb7b9034089 [formerly 85f2e1612aa067e93679e496b580c0c5087cb523] [formerly e5d114a5c7382d8ba36bb6b7572a1fb7b9034089 [formerly 85f2e1612aa067e93679e496b580c0c5087cb523] [formerly e5d114a5c7382d8ba36bb6b7572a1fb7b9034089 [formerly 85f2e1612aa067e93679e496b580c0c5087cb523] [formerly 85f2e1612aa067e93679e496b580c0c5087cb523 [formerly 54b4dd37e7cb11b18884f62e6d472f675fa56094 [formerly 874cc854461953812202adac9ba945143765877e]]]]]
Former-commit-id: a075e360d211406cfff0d666a51c55089aac93e1
Former-commit-id: bc46a0fc5fca5333fcf54dc6749b1350a0126105
Former-commit-id: c1f8179917fd25e05c9e1393651dfeb74f996fe9 [formerly 05c26e3f3da189f22b05f2e38c39f599507c6e22]
Former-commit-id: bbfc91d35fe18a5111634e1a9912c9a4d154d332
Former-commit-id: 03b7d2116f3b569ea2612b53a3fbd7c6a334f330
Former-commit-id: 4727aee57afd1392f404d936471b96ac567f3b25
Former-commit-id: 4e88bef44098b8086370b5298eaad686f05ffee8
Former-commit-id: fc0bf068107c3f7ac0d5cbef14e5131590bfbd82
This commit is contained in:
孙昊翔
2018-09-21 19:32:12 +08:00
2 changed files with 56 additions and 0 deletions

View File

@@ -4,9 +4,11 @@ export default `<template>
:columns="columns"
:data="data"
title="D2 CRUD"
add-mode
:rowHandle="rowHandle"
:form-template="formTemplate"
:form-options="formOptions"
@row-add="handleRowAdd"
@row-edit="handleRowEdit"
@dialog-cancel="handleDialogCancel"/>
</div>
@@ -92,6 +94,20 @@ export default {
address: {
title: '地址',
value: ''
},
forbidEdit: {
title: '禁用按钮',
value: false,
component: {
show: false
}
},
showEditButton: {
title: '显示按钮',
value: true,
component: {
show: false
}
}
},
formOptions: {
@@ -102,6 +118,18 @@ export default {
}
},
methods: {
handleRowAdd (row, done) {
this.formOptions.saveLoading = true
setTimeout(() => {
console.log(row)
this.$message({
message: '保存成功',
type: 'success'
})
done()
this.formOptions.saveLoading = false
}, 300)
},
handleRowEdit ({index, row}, done) {
this.formOptions.saveLoading = true
setTimeout(() => {

View File

@@ -5,9 +5,11 @@
:columns="columns"
:data="data"
title="D2 CRUD"
add-mode
:rowHandle="rowHandle"
:form-template="formTemplate"
:form-options="formOptions"
@row-add="handleRowAdd"
@row-edit="handleRowEdit"
@dialog-cancel="handleDialogCancel">
</d2-crud>
@@ -108,6 +110,20 @@ export default {
address: {
title: '地址',
value: ''
},
forbidEdit: {
title: '禁用按钮',
value: false,
component: {
show: false
}
},
showEditButton: {
title: '显示按钮',
value: true,
component: {
show: false
}
}
},
formOptions: {
@@ -118,6 +134,18 @@ export default {
}
},
methods: {
handleRowAdd (row, done) {
this.formOptions.saveLoading = true
setTimeout(() => {
console.log(row)
this.$message({
message: '保存成功',
type: 'success'
})
done()
this.formOptions.saveLoading = false
}, 300)
},
handleRowEdit ({ index, row }, done) {
this.formOptions.saveLoading = true
setTimeout(() => {