2018-09-19 10:58:28 +08:00
|
|
|
<template>
|
2019-04-27 20:08:40 +08:00
|
|
|
<d2-container>
|
2018-09-19 10:58:28 +08:00
|
|
|
<template slot="header">分页</template>
|
|
|
|
|
<d2-crud
|
|
|
|
|
:columns="columns"
|
|
|
|
|
:data="data"
|
2018-12-24 11:18:55 +08:00
|
|
|
:loading="loading"
|
|
|
|
|
:pagination="pagination"
|
|
|
|
|
@pagination-current-change="paginationCurrentChange"/>
|
2018-09-19 10:58:28 +08:00
|
|
|
<el-card shadow="never" class="d2-mb">
|
|
|
|
|
<d2-markdown :source="doc"/>
|
|
|
|
|
</el-card>
|
|
|
|
|
<el-card shadow="never" class="d2-mb">
|
|
|
|
|
<d2-highlight :code="code"/>
|
|
|
|
|
</el-card>
|
2019-08-28 09:41:42 +08:00
|
|
|
<d2-link-btn
|
|
|
|
|
slot="footer"
|
|
|
|
|
title="文档"
|
2019-12-15 22:55:50 +08:00
|
|
|
link="https://d2.pub/zh/doc/d2-crud-v2"/>
|
2018-09-19 10:58:28 +08:00
|
|
|
</d2-container>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2019-12-13 21:41:04 +08:00
|
|
|
import '../install'
|
2018-09-19 10:58:28 +08:00
|
|
|
import doc from './doc.md'
|
|
|
|
|
import code from './code.js'
|
2020-04-22 11:03:48 +08:00
|
|
|
import { businessTable1List } from '@api/demo.business.table.1'
|
2018-09-19 10:58:28 +08:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
doc,
|
|
|
|
|
code,
|
|
|
|
|
columns: [
|
|
|
|
|
{
|
2018-12-24 11:18:55 +08:00
|
|
|
title: '卡密',
|
|
|
|
|
key: 'key',
|
|
|
|
|
width: 320
|
2018-09-19 10:58:28 +08:00
|
|
|
},
|
|
|
|
|
{
|
2018-12-24 11:18:55 +08:00
|
|
|
title: '面值',
|
|
|
|
|
key: 'value'
|
2018-09-19 10:58:28 +08:00
|
|
|
},
|
|
|
|
|
{
|
2018-12-24 11:18:55 +08:00
|
|
|
title: '管理员',
|
|
|
|
|
key: 'admin'
|
2018-09-19 10:58:28 +08:00
|
|
|
},
|
|
|
|
|
{
|
2018-12-24 11:18:55 +08:00
|
|
|
title: '创建时间',
|
|
|
|
|
key: 'dateTimeCreat'
|
2018-09-19 10:58:28 +08:00
|
|
|
},
|
|
|
|
|
{
|
2018-12-24 11:18:55 +08:00
|
|
|
title: '使用时间',
|
|
|
|
|
key: 'dateTimeUse'
|
2018-09-19 10:58:28 +08:00
|
|
|
}
|
|
|
|
|
],
|
2018-12-24 11:18:55 +08:00
|
|
|
data: [],
|
|
|
|
|
loading: false,
|
2018-09-19 10:58:28 +08:00
|
|
|
pagination: {
|
2018-12-24 11:18:55 +08:00
|
|
|
currentPage: 1,
|
2018-09-19 10:58:28 +08:00
|
|
|
pageSize: 5,
|
2018-12-24 11:18:55 +08:00
|
|
|
total: 0
|
2018-09-19 10:58:28 +08:00
|
|
|
}
|
|
|
|
|
}
|
2018-12-24 11:18:55 +08:00
|
|
|
},
|
|
|
|
|
mounted () {
|
|
|
|
|
this.fetchData()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
paginationCurrentChange (currentPage) {
|
|
|
|
|
this.pagination.currentPage = currentPage
|
|
|
|
|
this.fetchData()
|
|
|
|
|
},
|
|
|
|
|
fetchData () {
|
|
|
|
|
this.loading = true
|
2020-04-22 11:03:48 +08:00
|
|
|
businessTable1List({
|
2018-12-24 11:18:55 +08:00
|
|
|
...this.pagination
|
|
|
|
|
}).then(res => {
|
|
|
|
|
this.data = res.list
|
|
|
|
|
this.pagination.total = res.page.total
|
|
|
|
|
this.loading = false
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
console.log('err', err)
|
2018-12-24 14:06:02 +08:00
|
|
|
this.loading = false
|
2018-12-24 11:18:55 +08:00
|
|
|
})
|
|
|
|
|
}
|
2018-09-19 10:58:28 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|