d2-crud 多选
Former-commit-id: 03eb3705b1f66c57db9012a345116d1f38828d1f [formerly 03eb3705b1f66c57db9012a345116d1f38828d1f [formerly 03eb3705b1f66c57db9012a345116d1f38828d1f [formerly 03eb3705b1f66c57db9012a345116d1f38828d1f [formerly 95e7fa332cda6f867f92f47137c8c4c94e03c6e7 [formerly 51c3e521e4f6e68486fd59ea1e035063b6ec8d85]]]]] Former-commit-id: 8dfd3b99c8d2aeaa82b2e6c173d1295fb4ca2012 Former-commit-id: 8b14e630aefa470c1ce99e5655ea1ef7c9e141f6 Former-commit-id: 80a47cc1021961a83fbc0604acba1c1c3d067df4 [formerly 3afe605e0c1770916086fed8b964f8f2c9aca2cd] Former-commit-id: cae4ccd332a7ff38cad19c5339a24e0693a87c36 Former-commit-id: e634a3efc2466b2058835c703fd87d02b1adc05d Former-commit-id: 5da1bbe8d1991c7e1cb66e7d42690ffd82a7a8ba Former-commit-id: 01f44332a5592df69e26812678f92df1f7137a2e Former-commit-id: 017fe99ac8d9194cc8959c90d28393035ed78436
This commit is contained in:
@@ -10,3 +10,5 @@
|
|||||||
| 固定列 | [点我查看](https://fairyever.gitee.io/d2-admin-preview/#/demo/d2-crud/demo6) |
|
| 固定列 | [点我查看](https://fairyever.gitee.io/d2-admin-preview/#/demo/d2-crud/demo6) |
|
||||||
| 流体高度 | [点我查看](https://fairyever.gitee.io/d2-admin-preview/#/demo/d2-crud/demo7) |
|
| 流体高度 | [点我查看](https://fairyever.gitee.io/d2-admin-preview/#/demo/d2-crud/demo7) |
|
||||||
| 多级表头 | [点我查看](https://fairyever.gitee.io/d2-admin-preview/#/demo/d2-crud/demo8) |
|
| 多级表头 | [点我查看](https://fairyever.gitee.io/d2-admin-preview/#/demo/d2-crud/demo8) |
|
||||||
|
| 单选 | [点我查看](https://fairyever.gitee.io/d2-admin-preview/#/demo/d2-crud/demo9) |
|
||||||
|
| 多选 | [点我查看](https://fairyever.gitee.io/d2-admin-preview/#/demo/d2-crud/demo10) |
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export default {
|
|||||||
{ path: `${pre}demo6`, title: '固定列' },
|
{ path: `${pre}demo6`, title: '固定列' },
|
||||||
{ path: `${pre}demo7`, title: '流体高度' },
|
{ path: `${pre}demo7`, title: '流体高度' },
|
||||||
{ path: `${pre}demo8`, title: '多级表头' },
|
{ path: `${pre}demo8`, title: '多级表头' },
|
||||||
{ path: `${pre}demo9`, title: '单选' }
|
{ path: `${pre}demo9`, title: '单选' },
|
||||||
|
{ path: `${pre}demo10`, title: '多选' }
|
||||||
])('/demo/d2-crud/')
|
])('/demo/d2-crud/')
|
||||||
}
|
}
|
||||||
|
|||||||
59
src/pages/demo/d2-crud/demo10/code.js
Normal file
59
src/pages/demo/d2-crud/demo10/code.js
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
export default `<template>
|
||||||
|
<div>
|
||||||
|
<d2-crud
|
||||||
|
:columns="columns"
|
||||||
|
:data="data"
|
||||||
|
selection-row
|
||||||
|
@selection-change="handleSelectionChange"/>
|
||||||
|
</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 弄'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleSelectionChange (selection) {
|
||||||
|
console.log(selection)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>`
|
||||||
1
src/pages/demo/d2-crud/demo10/doc.md
Normal file
1
src/pages/demo/d2-crud/demo10/doc.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
`D2 Crud` 组件提供了多选的支持,只需要配置 `selection-row` 属性即可实现多选。之后由 `selection-change` 事件来管理选择项发生变化时触发的事件,它会传入 `selection` 。代码如下:
|
||||||
85
src/pages/demo/d2-crud/demo10/index.vue
Normal file
85
src/pages/demo/d2-crud/demo10/index.vue
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<template>
|
||||||
|
<d2-container>
|
||||||
|
<template slot="header">多选</template>
|
||||||
|
<d2-crud
|
||||||
|
:columns="columns"
|
||||||
|
:data="data"
|
||||||
|
selection-row
|
||||||
|
@selection-change="handleSelectionChange">
|
||||||
|
</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 弄'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleSelectionChange (selection) {
|
||||||
|
console.log(selection)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.el-table .warning-row {
|
||||||
|
background: oldlace;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table .success-row {
|
||||||
|
background: #f0f9eb;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1 +1 @@
|
|||||||
b8b55dc98d4d6c94c6fc66cd1e953f7637936ed4
|
2f4b1ce7274521abba33ad6509f239a4fc7ede76
|
||||||
Reference in New Issue
Block a user