demo31
Former-commit-id: f3591905bf88c7d95047cb6651f9cdc77fc58cbd [formerly f3591905bf88c7d95047cb6651f9cdc77fc58cbd [formerly f3591905bf88c7d95047cb6651f9cdc77fc58cbd [formerly f3591905bf88c7d95047cb6651f9cdc77fc58cbd [formerly 3dd6a8182394b5e228415fdb74cafa540ff637ce [formerly 2357e57aaa8e9446e37a6bddb38974e1925bf55d]]]]] Former-commit-id: fbac67443f4b103cc40afdac42189d6030c02374 Former-commit-id: 113f699cf579ea681f97a17a90783909e817c754 Former-commit-id: 342be87ea820c21a99677f4bf367cf86208ac805 [formerly 5d23eec7280ba7a52e1b1622cb2b27f95172e8ff] Former-commit-id: 785cbd080e51be48484fbd7c41e931a796922de8 Former-commit-id: 52b5723a9e77044a86c63b4fe239945b74ce89a0 Former-commit-id: 073b10060b38e82221b4c3ce14e96a50c8155d12 Former-commit-id: 3120c8c429a6986b53bdc34e401965d181cadb41 Former-commit-id: bc38d66f3039940a24fc8958a11050e1058ae37e
This commit is contained in:
105
src/pages/demo/d2-crud/demo31/index.vue
Normal file
105
src/pages/demo/d2-crud/demo31/index.vue
Normal file
@@ -0,0 +1,105 @@
|
||||
<template>
|
||||
<d2-container :filename="filename">
|
||||
<template slot="header">Crud事件</template>
|
||||
<d2-crud
|
||||
ref="d2Crud"
|
||||
:columns="columns"
|
||||
:data="data">
|
||||
<el-button slot="header" style="margin-bottom: 5px" @click="updateCell">更新第二行日期</el-button>
|
||||
<el-button slot="header" style="margin-bottom: 5px" @click="updateRow">更新第三行所有数据</el-button>
|
||||
<el-button slot="header" style="margin-bottom: 5px" @click="addRow">新增一行</el-button>
|
||||
<el-button slot="header" style="margin-bottom: 5px" @click="removeRow">删除最后一行</el-button>
|
||||
</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="文档" link="https://doc.d2admin.fairyever.com/zh/ecosystem-d2-crud/"/>
|
||||
</template>
|
||||
</d2-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import doc from './doc.md'
|
||||
import code from './code.js'
|
||||
import { BusinessTable1List } from '@api/demo.business.table.1'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
filename: __filename,
|
||||
doc,
|
||||
code,
|
||||
columns: [
|
||||
{
|
||||
title: '日期',
|
||||
key: 'date'
|
||||
},
|
||||
{
|
||||
title: '姓名',
|
||||
key: 'name'
|
||||
},
|
||||
{
|
||||
title: '地址',
|
||||
key: 'address'
|
||||
}
|
||||
],
|
||||
data: [
|
||||
{
|
||||
date: '2016-05-02',
|
||||
name: '王小虎',
|
||||
address: '上海市普陀区金沙江路 1518 弄',
|
||||
forbidEdit: true,
|
||||
showEditButton: true
|
||||
},
|
||||
{
|
||||
date: '2016-05-04',
|
||||
name: '王小虎',
|
||||
address: '上海市普陀区金沙江路 1517 弄',
|
||||
forbidEdit: false,
|
||||
showEditButton: true
|
||||
},
|
||||
{
|
||||
date: '2016-05-01',
|
||||
name: '王小虎',
|
||||
address: '上海市普陀区金沙江路 1519 弄',
|
||||
forbidEdit: false,
|
||||
showEditButton: false
|
||||
},
|
||||
{
|
||||
date: '2016-05-03',
|
||||
name: '王小虎',
|
||||
address: '上海市普陀区金沙江路 1516 弄',
|
||||
forbidEdit: false,
|
||||
showEditButton: true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateCell () {
|
||||
this.$refs.d2Crud.updateCell(1, 'date', '2018-01-01')
|
||||
},
|
||||
updateRow () {
|
||||
this.$refs.d2Crud.updateRow(2, {
|
||||
date: '2018-01-01',
|
||||
name: '王小小',
|
||||
address: '上海市普陀区金沙江路 2333 弄'
|
||||
})
|
||||
},
|
||||
addRow () {
|
||||
this.$refs.d2Crud.addRow({
|
||||
date: '2018-01-01',
|
||||
name: '王小二',
|
||||
address: '上海市普陀区金沙江路 7777 弄'
|
||||
})
|
||||
},
|
||||
removeRow () {
|
||||
this.$refs.d2Crud.removeRow(this.$refs.d2Crud.d2CrudData.length - 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user