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

View File

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

View File

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