Files
vxe-table/examples/views/table/base/FixedFull.vue
xuliangzhan 2eb6bf0036 更新文档
2020-01-13 18:11:44 +08:00

160 lines
5.1 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 class="tip">横纵内容过多时同时固定列和表头</p>
<vxe-table
border
resizable
height="300"
highlight-hover-row
:data="tableData">
<vxe-table-column type="seq" 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 title="操作" fixed="right" width="200">
<template>
<vxe-button type="text">按钮1</vxe-button>
<vxe-button type="text">按钮2</vxe-button>
</template>
</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 class="tip">固定列建议设置 <table-api-link prop="show-overflow"/> 该值禁用自动换行大幅提升渲染速度</p>
<vxe-table
border
height="300"
highlight-hover-row
show-overflow
:data="tableData">
<vxe-table-column type="seq" 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 title="操作" fixed="right" width="200">
<template>
<vxe-button status="primary">按钮1</vxe-button>
<vxe-button>按钮2</vxe-button>
</template>
</vxe-table-column>
</vxe-table>
<pre>
<code>
| Arrow Up | 匀速向上滚动数据 |
| Arrow Down | 匀速向下滚动数据 |
| Arrow Left | 匀速向左滚动数据 |
| Arrow Right | 匀速向右滚动数据 |
| Page Up | 向上翻页滚动 |
| Page Down | 向下翻页滚动 |
| Spacebar | 翻页滚动 |
| Home | 滚动到顶部 |
| End | 滚动到底部 |
</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 {
tableData: [],
demoCodes: [
`
<vxe-table
border
resizable
height="300"
highlight-hover-row
:data="tableData">
<vxe-table-column type="seq" 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 title="操作" fixed="right" width="200">
<template>
<vxe-button type="text">按钮1</vxe-button>
<vxe-button type="text">按钮2</vxe-button>
</template>
</vxe-table-column>
</vxe-table>
`,
`
export default {
data () {
return {
tableData: []
}
},
created () {
this.tableData = window.MOCK_DATA_LIST.slice(0, 20)
}
}
`,
`
<vxe-table
border
height="300"
highlight-hover-row
show-overflow
:data="tableData">
<vxe-table-column type="seq" 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 title="操作" fixed="right" width="200">
<template>
<vxe-button status="primary">按钮1</vxe-button>
<vxe-button>按钮2</vxe-button>
</template>
</vxe-table-column>
</vxe-table>
`,
`
export default {
data () {
return {
tableData: []
}
},
created () {
this.tableData = window.MOCK_DATA_LIST.slice(0, 20)
}
}
`
]
}
},
created () {
this.tableData = window.MOCK_DATA_LIST.slice(0, 20)
},
mounted () {
Array.from(this.$el.querySelectorAll('pre code')).forEach((block) => {
hljs.highlightBlock(block)
})
}
}
</script>