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

@ -31,4 +31,4 @@ new Vue({
})
```
之后就可以在项目中使用`D2-Crud`了,具体使用方法请参考 [使用指南](./api.md)
之后就可以在项目中使用`D2-Crud`了。具体使用方法请参考 [示例](./example.md)

View File

@ -1,3 +1 @@
# 使用指南
## 基础表格
# API

View File

@ -0,0 +1,5 @@
# 示例
| 示例 | 代码与演示 |
| --- | --- |
| 基础表格 | [点我查看](https://fairyever.gitee.io//d2-admin-preview/#/demo/d2-crud/demo1) |

View File

@ -4,6 +4,6 @@ export default {
icon: 'table',
children: (pre => [
{ path: `${pre}index`, title: 'D2 CRUD 首页', icon: 'home' },
{ path: `${pre}demo1`, title: '基表格' }
{ path: `${pre}demo1`, title: '基表格' }
])('/demo/d2-crud/')
}

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: '地址',

View File

@ -1 +1 @@
6c0089557b3f47ce1383b439360cea062285b4b9
32a7ea0783b0602f53515540de1e323f60edd792