Files
vxe-table/examples/views/table/base/FixedFull.vue
xuliangzhan c02d7bc112 update
2019-08-04 19:51:56 +08:00

139 lines
4.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>横纵内容过多时同时固定列和表头</p>
<vxe-table
border
height="300"
highlight-hover-row
show-overflow
:data.sync="tableData">
<vxe-table-column type="index" width="60" fixed="left"></vxe-table-column>
<vxe-table-column field="name" title="Name" width="300"></vxe-table-column>
<vxe-table-column field="role" title="Role" width="300"></vxe-table-column>
<vxe-table-column field="sex" title="Sex" width="300"></vxe-table-column>
<vxe-table-column field="date" title="Date" width="300"></vxe-table-column>
<vxe-table-column field="address" title="Address" fixed="right" width="300"></vxe-table-column>
</vxe-table>
<p class="demo-code">{{ $t('app.body.button.showCode') }}</p>
<pre>
<code class="xml">{{ demoCodes[0] }}</code>
<code class="javascript">{{ demoCodes[1] }}</code>
</pre>
<p>固定列建议设置 show-overflow show-overflow 该值禁用自动换行大幅提升渲染速度</p>
<keep-alive>
<vxe-table
border
height="300"
highlight-hover-row
show-overflow
v-if="visible"
:data.sync="tableData">
<vxe-table-column type="index" width="60" fixed="left"></vxe-table-column>
<vxe-table-column field="name" title="Name" width="300"></vxe-table-column>
<vxe-table-column field="role" title="Role" width="300"></vxe-table-column>
<vxe-table-column field="sex" title="Sex" width="300"></vxe-table-column>
<vxe-table-column field="date" title="Date" width="300"></vxe-table-column>
<vxe-table-column field="address" title="Address" fixed="right" width="300"></vxe-table-column>
</vxe-table>
</keep-alive>
<pre>
<code>
| Arrow Up | 匀速向上滚动数据 |
| Arrow Down | 匀速向下滚动数据 |
| Arrow Left | 匀速向左滚动数据 |
| Arrow Right | 匀速向右滚动数据 |
</code>
</pre>
<p class="demo-code">{{ $t('app.body.button.showCode') }}</p>
<pre>
<code class="xml">{{ demoCodes[2] }}</code>
<code class="javascript">{{ demoCodes[3] }}</code>
</pre>
</div>
</template>
<script>
import hljs from 'highlight.js'
export default {
data () {
return {
visible: true,
tableData: [],
demoCodes: [
`
<vxe-table
border
height="300"
highlight-hover-row
show-overflow
:data.sync="tableData">
<vxe-table-column type="index" width="60" fixed="left"></vxe-table-column>
<vxe-table-column field="name" title="Name" width="300"></vxe-table-column>
<vxe-table-column field="role" title="Role" width="300"></vxe-table-column>
<vxe-table-column field="sex" title="Sex" width="300"></vxe-table-column>
<vxe-table-column field="date" title="Date" width="300"></vxe-table-column>
<vxe-table-column field="address" title="Address" fixed="right" width="300"></vxe-table-column>
</vxe-table>
`,
`
export default {
data () {
return {
tableData: []
}
},
created () {
this.tableData = window.MOCK_DATA_LIST.slice(0, 50)
}
}
`,
`
<vxe-table
border
height="300"
highlight-hover-row
show-overflow
:data.sync="tableData">
<vxe-table-column type="index" width="60" fixed="left"></vxe-table-column>
<vxe-table-column field="name" title="Name" width="300"></vxe-table-column>
<vxe-table-column field="role" title="Role" width="300"></vxe-table-column>
<vxe-table-column field="sex" title="Sex" width="300"></vxe-table-column>
<vxe-table-column field="date" title="Date" width="300"></vxe-table-column>
<vxe-table-column field="address" title="Address" fixed="right" width="300"></vxe-table-column>
</vxe-table>
`,
`
export default {
data () {
return {
tableData: []
}
},
created () {
this.tableData = window.MOCK_DATA_LIST.slice(0, 50)
}
}
`
]
}
},
created () {
this.tableData = window.MOCK_DATA_LIST.slice(0, 50)
},
mounted () {
Array.from(this.$el.querySelectorAll('pre code')).forEach((block) => {
hljs.highlightBlock(block)
})
}
}
</script>