Former-commit-id: 9c27f9a31685f7f2bbac6753223d3cba80df5137 [formerly 9c27f9a31685f7f2bbac6753223d3cba80df5137 [formerly 9c27f9a31685f7f2bbac6753223d3cba80df5137 [formerly 9c27f9a31685f7f2bbac6753223d3cba80df5137 [formerly d1a4eeaf471e7dde786603eb5feba15d2d3a273f [formerly c07b0a08a3c2fa248ca6ff7568d45015db2d3147]]]]]
Former-commit-id: f196405033174efe983252ad2f0aced44428e859
Former-commit-id: affb0b740a6120516a0207a592675b2c26607472
Former-commit-id: b6ad9a07ba29066dcc3cad28814a1b23c05d1d10 [formerly c7d64ee76aab116775b1f19540d6d67782886669]
Former-commit-id: 429004729676144772d6abf85e1bb94f83877de3
Former-commit-id: 4bd505129cfb36ff4576aeeb246bd8b6b6340dcb
Former-commit-id: 877886e90cc33ae1dedd23580f3ca6ffe698ad84
Former-commit-id: f1964760a2efe6edf0de208d07808e429b8d6d9c
Former-commit-id: f55839b8058fbbe298e36c69936c88645fe4be0e
This commit is contained in:
孙昊翔
2018-12-24 10:20:23 +08:00
parent 46ad024bdf
commit 365a79f813
3 changed files with 44 additions and 45 deletions

View File

@@ -1,12 +1,16 @@
export default `<template> export default `<template>
<div> <div>
<d2-crud <d2-crud
ref="d2Crud" ref="d2Crud"
:columns="columns" :columns="columns"
:data="data"> :data="data">
<el-button slot="headerButton">自定义按钮1</el-button> <el-input slot="header" placeholder="请输入内容" style="margin-bottom: 5px">
<el-button slot="headerButton" type="primary" round>自定义按钮2</el-button> <template slot="prepend">Http://</template>
</d2-crud> <template slot="append">.com</template>
</el-input>
<el-button slot="header" style="margin-bottom: 5px">自定义按钮1</el-button>
<el-button slot="header" type="primary" round style="margin-bottom: 5px">自定义按钮2</el-button>
</d2-crud>
</div> </div>
</template> </template>
@@ -53,9 +57,6 @@ export default {
} }
] ]
} }
},
mounted () {
console.log(this.$refs.d2Crud.d2Data)
} }
} }
</script>` </script>`

View File

@@ -1 +1 @@
`headerButton` slot 可以在表头添加自定义按钮。代码如下: `header` slot 可以在表头添加自定义内容。代码如下:

View File

@@ -1,12 +1,13 @@
<template> <template>
<d2-container :filename="filename"> <d2-container :filename="filename">
<template slot="header">表格slot</template> <template slot="header">表格slot</template>
<d2-crud <d2-crud ref="d2Crud" :columns="columns" :data="data">
ref="d2Crud" <el-input slot="header" placeholder="请输入内容" style="margin-bottom: 5px">
:columns="columns" <template slot="prepend">Http://</template>
:data="data"> <template slot="append">.com</template>
<el-button slot="headerButton">自定义按钮1</el-button> </el-input>
<el-button slot="headerButton" type="primary" round>自定义按钮2</el-button> <el-button slot="header" style="margin-bottom: 5px">自定义按钮1</el-button>
<el-button slot="header" type="primary" round style="margin-bottom: 5px">自定义按钮2</el-button>
</d2-crud> </d2-crud>
<el-card shadow="never" class="d2-mb"> <el-card shadow="never" class="d2-mb">
<d2-markdown :source="doc"/> <d2-markdown :source="doc"/>
@@ -21,57 +22,54 @@
</template> </template>
<script> <script>
import doc from './doc.md' import doc from "./doc.md";
import code from './code.js' import code from "./code.js";
export default { export default {
data () { data() {
return { return {
filename: __filename, filename: __filename,
doc, doc,
code, code,
columns: [ columns: [
{ {
title: '日期', title: "日期",
key: 'date', key: "date",
width: '180' width: "180"
}, },
{ {
title: '姓名', title: "姓名",
key: 'name', key: "name",
width: '180' width: "180"
}, },
{ {
title: '地址', title: "地址",
key: 'address' key: "address"
} }
], ],
data: [ data: [
{ {
date: '2016-05-02', date: "2016-05-02",
name: '王小虎', name: "王小虎",
address: '上海市普陀区金沙江路 1518 弄' address: "上海市普陀区金沙江路 1518 弄"
}, },
{ {
date: '2016-05-04', date: "2016-05-04",
name: '王小虎', name: "王小虎",
address: '上海市普陀区金沙江路 1517 弄' address: "上海市普陀区金沙江路 1517 弄"
}, },
{ {
date: '2016-05-01', date: "2016-05-01",
name: '王小虎', name: "王小虎",
address: '上海市普陀区金沙江路 1519 弄' address: "上海市普陀区金沙江路 1519 弄"
}, },
{ {
date: '2016-05-03', date: "2016-05-03",
name: '王小虎', name: "王小虎",
address: '上海市普陀区金沙江路 1516 弄' address: "上海市普陀区金沙江路 1516 弄"
} }
] ]
} };
},
mounted () {
console.log(this.$refs.d2Crud.d2Data)
} }
} };
</script> </script>