Files
vxe-table/examples/views/table/advanced/Keyboard.vue
xuliangzhan 78279f6872 update
2019-08-29 09:38:57 +08:00

83 lines
2.2 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">键盘移动高亮行设置 <table-api-link prop="keyboard-config"/>={isArrow: true} 启用方向键功能</p>
<vxe-table
border
resizable
highlight-current-row
height="500"
:data="tableData"
:keyboard-config="{isArrow: true}">
<vxe-table-column type="index" width="60"></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="age" title="Age"></vxe-table-column>
<vxe-table-column field="address" title="Address" show-overflow></vxe-table-column>
</vxe-table>
<pre>
<code>
| Arrow Up | 移动到高亮行的上一行 |
| Arrow Down | 移动到高亮行的下一行 |
</code>
</pre>
<p class="demo-code">{{ $t('app.body.button.showCode') }}</p>
<pre>
<code class="xml">{{ demoCodes[0] }}</code>
<code class="javascript">{{ demoCodes[1] }}</code>
</pre>
</div>
</template>
<script>
import hljs from 'highlight.js'
export default {
data () {
return {
tableData: [],
demoCodes: [
`
<vxe-table
border
resizable
highlight-current-row
height="500"
:data="tableData"
:keyboard-config="{isArrow: true}">
<vxe-table-column type="index" width="60"></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="age" title="Age"></vxe-table-column>
<vxe-table-column field="address" title="Address" show-overflow></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>