d2-crud 基础表格示例

Former-commit-id: de858da799b11ddb64f8f1c70a927abf3ffe541a [formerly de858da799b11ddb64f8f1c70a927abf3ffe541a [formerly de858da799b11ddb64f8f1c70a927abf3ffe541a [formerly de858da799b11ddb64f8f1c70a927abf3ffe541a [formerly dc719910e44385130a5d15d61010d4567ac69e4d [formerly e3008d8f05e5255a733d12ed45270824b112ffb2]]]]]
Former-commit-id: 8fd75dfb370c84815e9e20e4bea39730a5b7ef63
Former-commit-id: a70d95d941b30cb2dd2111e09e2dfba4352667fd
Former-commit-id: d460cd4cfbe159a6dc21779a9c3df2ba3f74e806 [formerly cd9ca40d9b4ff3f146364e69dfe8c7d4104e6dea]
Former-commit-id: 990c9ad6ad73bb009004e47b0640dd5a49d908eb
Former-commit-id: 9af35feccd694c5eeaed4029477548504981afc8
Former-commit-id: 4c84831bbf31546a1468f5bcf377c1062370c1cc
Former-commit-id: 0fb1ef7e88759452800461cde28b25d7c1155570
Former-commit-id: f26e220278c0a9d4e939b343200d70ed75d17758
This commit is contained in:
孙昊翔
2018-08-27 13:18:06 +08:00
parent 993e54d64b
commit afeeca7247
7 changed files with 80 additions and 12 deletions

View File

@@ -0,0 +1,54 @@
export default `<template>
<div>
<d2-crud
:columns="columns"
:data="data"/>
</div>
</template>
<script>
export default {
data () {
return {
columns: [
{
title: '日期',
key: 'date',
width: '180'
},
{
title: '姓名',
key: 'name',
width: '180'
},
{
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 弄'
}
]
}
}
}
</script>`

View File

@@ -1,11 +1,17 @@
<template>
<d2-container>
<template slot="header">表格</template>
<template slot="header">表格</template>
<d2-crud
:columns="columns"
:data="data"
>
</d2-crud>
:data="data"/>
<el-card shadow="never" class="d2-mb">
<p>
在d2-crud元素中注入columns和data对象数组即可创建一个最基础的表格可以在columns对象中传入width属性来控制列宽代码如下
</p>
</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>
@@ -13,17 +19,22 @@
</template>
<script>
import code from './code.js'
export default {
data () {
return {
code,
columns: [
{
title: '日期',
key: 'date'
key: 'date',
width: '180'
},
{
title: '姓名',
key: 'name'
key: 'name',
width: '180'
},
{
title: '地址',