Files
vxe-table/examples/views/table/base/Index.vue
xuliangzhan c7813125bb update
2019-06-28 18:13:37 +08:00

51 lines
1.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div>
<p>默认的序号从 1 开始你也可以自定义 <table-column-api-link prop="index-method"/> 函数</p>
<vxe-table
border
highlight-hover-row
:data.sync="tableData">
<vxe-table-column type="index" width="60"></vxe-table-column>
<vxe-table-column field="name" title="Name" sortable></vxe-table-column>
<vxe-table-column field="sex" title="Sex"></vxe-table-column>
<vxe-table-column field="age" title="Age"></vxe-table-column>
<vxe-table-column field="address" title="Address" show-overflow></vxe-table-column>
</vxe-table>
<p>使用 <table-column-api-link prop="index-method"/> 自定义序号</p>
<vxe-table
border
height="300"
:data.sync="tableData2">
<vxe-table-column type="index" title="序号" width="60" :index-method="indexMethod"></vxe-table-column>
<vxe-table-column field="name" title="Name" sortable></vxe-table-column>
<vxe-table-column field="sex" title="Sex"></vxe-table-column>
<vxe-table-column field="age" title="Age"></vxe-table-column>
<vxe-table-column field="address" title="Address" show-overflow></vxe-table-column>
</vxe-table>
</div>
</template>
<script>
export default {
data () {
return {
tableData: [],
tableData2: []
}
},
created () {
let list = window.MOCK_DATA_LIST.slice(0, 4)
this.tableData = list
this.tableData2 = window.MOCK_DATA_LIST.slice(0, 50)
},
methods: {
indexMethod ({ rowIndex }) {
return rowIndex * 2
}
}
}
</script>