表格组件示例
Former-commit-id: dd9ec5144e4c4668498c42327126c9cd2ff9590a [formerly dd9ec5144e4c4668498c42327126c9cd2ff9590a [formerly dd9ec5144e4c4668498c42327126c9cd2ff9590a [formerly dd9ec5144e4c4668498c42327126c9cd2ff9590a [formerly 096c7586394466fcfa6aeef76f941c65b6c58cb3 [formerly 6ea50546558bb7a5f54d99d34301d3fbae8beea4]]]]] Former-commit-id: 4909868f8dac1be92c76feda0bc3c4a51f8221ca Former-commit-id: 7bcf816a13380e5e1823ef3d8a0050fa95842c73 Former-commit-id: cea58af19fb83f6e4f61a7cc95e999706784a7f2 [formerly 881c7fe80386e4bbd6bdd323eb873c98e7894941] Former-commit-id: edf39aef375f7ecf4d07951f57b8a92baab4ee37 Former-commit-id: 829a819ac72421f791a5cf5a4d62b7a860e7648b Former-commit-id: e3da2e3e4a6f41a5a712760729560efdcf551a3f Former-commit-id: 57e8f1b908c2578a985798a6672a650b9dc53c0c Former-commit-id: 9667afc9b61cdbc5c624a07ee92b4156d0470582
This commit is contained in:
@@ -2,56 +2,35 @@
|
||||
<d2-container type="ghost">
|
||||
<template slot="header">表格组件</template>
|
||||
<div class="d2-mt d2-mr">
|
||||
|
||||
<el-card shadow="never" class="d2-card">
|
||||
<template slot="header">基础用法</template>
|
||||
<el-table
|
||||
:data="tableData"
|
||||
style="width: 100%">
|
||||
<el-table-column
|
||||
prop="date"
|
||||
label="日期"
|
||||
width="180">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="name"
|
||||
label="姓名"
|
||||
width="180">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="address"
|
||||
label="地址">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-card
|
||||
v-for="(table, index) in tableList"
|
||||
:key="index"
|
||||
shadow="never"
|
||||
class="d2-card d2-mb">
|
||||
<template slot="header">{{table.title}}</template>
|
||||
<component :is="table.component"/>
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
</d2-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const req = context => context.keys().map(context)
|
||||
const tables = req(require.context('./components', true, /\.vue$/))
|
||||
const components = {}
|
||||
const tableList = []
|
||||
tables.forEach((table, index) => {
|
||||
components[`d2-demo-el-table-${index + 1}`] = table.default
|
||||
tableList.push({
|
||||
title: table.default.title,
|
||||
component: `d2-demo-el-table-${index + 1}`
|
||||
})
|
||||
})
|
||||
export default {
|
||||
components,
|
||||
data () {
|
||||
return {
|
||||
tableData: [
|
||||
{
|
||||
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 弄'
|
||||
}
|
||||
]
|
||||
tableList
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user