Files
vxe-table/examples/views/table/base/FixedFull.vue
xuliangzhan 92cea20c7b update
2019-08-30 22:09:34 +08:00

156 lines
5.0 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
height="300"
highlight-hover-row
:data="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 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">固定列建议设置 show-overflow show-overflow 该值禁用自动换行大幅提升渲染速度</p>
<vxe-table
border
height="300"
highlight-hover-row
show-overflow
v-if="visible"
:data="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 title="操作" fixed="right" width="200">
<template>
<vxe-button type="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 | 匀速向右滚动数据 |
</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
:data="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 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, 50)
}
}
`,
`
<vxe-table
border
height="300"
highlight-hover-row
show-overflow
v-if="visible"
:data="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 title="操作" fixed="right" width="200">
<template>
<vxe-button type="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, 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>