console
/* Vue.use(VueVirtualScroller)
Vue.component('RecycleScroller', VueVirtualScroller.RecycleScroller)
*/
/* console.log('xx', VueVirtualScroller) */
var Main = {
data() {
return {
tableData: [],
columns: [
/* {
type: 'expand',
width: 100,
slots: { content: 'fileExpand', default: 'cellExpand' }
}, */
{ type: 'expand', width: 60, slots: {
content: 'fileExpand',
default: 'cellExpand'
}
},
{
type: 'checkbox',
width: 60
},
{
// title: '序号',
type: 'seq',
// fixed: 'left',
width: 100
},
{
title: 'Name',
field: 'name',
width: 100
},
{
title: 'Sex',
field: 'sex',
width: 100
},
{
title: 'Date',
field: 'date',
width: 100
},
]
}
},
created () {
var list = []
for(var index = 0; index < 2000; index++){
var item = {
id: index + '_xxx',
checked: false,
name: 'test' + index,
role: 'developer',
sex: 'Man',
date: '2019-05-01',
time: 1556677810888 + index * 500,
region: 'ShenZhen',
address: 'address abc' + index
}
list.push(item)
}
this.tableData = list
}
};
var Ctor = Vue.extend(Main);
new Ctor().$mount('#app')
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14"></script>
<script src="https://cdn.jsdelivr.net/npm/xe-utils@3.3.0"></script>
<script src="https://cdn.jsdelivr.net/npm/vxe-table@3.3.8"></script>
<script src="https://raw.githubusercontent.com/Akryum/vue-virtual-scroller/master/dist/vue-virtual-scroller.min.js"></script>
<div id="app">
<template>
<div>
<vxe-grid
border
resizable
ref="xGrid"
max-height="500"
:columns="[
{ type: 'seq', width: 50 },
{ type: 'expand', width: 120, slots: {
content: 'fileExpand',
default: 'cellExpand'
}
},
{ field: 'name', title: 'app.body.label.name' },
{ field: 'sex', title: 'app.body.label.sex' },
{ title: '操作', width: 160, showOverflow: true, slots: { default: 'operation' } }
]"
:data="[
{ name: 'name1', sex: '男', age: '26', fileList: [] },
{ name: 'name2', sex: '女', age: '28', fileList: [] },
{ name: 'name3', sex: '男', age: '30', fileList: [] }
]">
<template #fileExpand="{ row }">
<div>124124</div>
</template>
<template #cellExpand="{ row }">
<span>1644</span>
</template>
<template #operation="{ row }">
<vxe-button status="primary">添加附件</vxe-button>
</template>
</vxe-grid>
<vxe-grid
border
resizable
show-overflow
show-header-overflow
highlight-hover-row
highlight-current-row
ref="xGrid"
height="300"
:columns="columns"
:data="tableData">
<template #fileExpand="{ row }">
{{ row.name }}
</template>
<template #cellExpand="{ row }">
<span>(1644)</span>
</template>
</vxe-grid>
<vxe-table
border
resizable
height="400"
:data="tableData"
:expand-config="{ expandAll: true }"
:enabled="false">
<vxe-table-column type="expand" width="60">
<template v-slot:content="{ row }">
<div style="height:76px">
<ul>
<li>
<span>ID:</span>
<span>{{ row.id }}</span>
</li>
<li>
<span>Name:</span>
<span>{{ row.name }}</span>
</li>
<li>
<span>UpdateTime:</span>
<span>{{ row.updateTime }}</span>
</li>
<li>
<span>CreateTime:</span>
<span>{{ row.createTime }}</span>
</li>
</ul>
</div>
</template>
</vxe-table-column>
<vxe-table-column field="name" title="Name"></vxe-table-column>
<vxe-table-column field="sex" title="Sex"></vxe-table-column>
<vxe-table-column field="date" title="Date"></vxe-table-column>
</vxe-table>
</div>
</template>
</div>
@import url("https://cdn.jsdelivr.net/npm/vxe-table/lib/style.css");