mirror of
https://gitee.com/xuliangzhan_admin/vxe-table.git
synced 2026-01-21 05:27:57 +08:00
70 lines
2.1 KiB
Vue
70 lines
2.1 KiB
Vue
<template>
|
||
<div>
|
||
<p class="tip">复选框的范围选中功能,通过配置项 <table-api-link prop="checkbox-config"/>={<table-api-link prop="range"/>} 启用,还可以同时按住 ctrl 键取消/勾选不连续的行</p>
|
||
|
||
<vxe-table
|
||
border
|
||
:checkbox-config="{trigger: 'row', highlight: true, range: true}"
|
||
:data="tableData">
|
||
<vxe-table-column type="checkbox" width="80"></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="time" title="Time"></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>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import hljs from 'highlight.js'
|
||
|
||
export default {
|
||
data () {
|
||
return {
|
||
tableData: [],
|
||
demoCodes: [
|
||
`
|
||
<vxe-table
|
||
border
|
||
:checkbox-config="{trigger: 'row', highlight: true, range: true}"
|
||
:data="tableData">
|
||
<vxe-table-column type="checkbox" width="80"></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="time" title="Time"></vxe-table-column>
|
||
</vxe-table>
|
||
`,
|
||
`
|
||
export default {
|
||
data () {
|
||
return {
|
||
tableData: []
|
||
}
|
||
},
|
||
created () {
|
||
this.tableData = window.MOCK_DATA_LIST.slice(0, 6)
|
||
}
|
||
}
|
||
`
|
||
]
|
||
}
|
||
},
|
||
created () {
|
||
this.tableData = window.MOCK_DATA_LIST.slice(0, 6)
|
||
},
|
||
mounted () {
|
||
Array.from(this.$el.querySelectorAll('pre code')).forEach((block) => {
|
||
hljs.highlightBlock(block)
|
||
})
|
||
}
|
||
}
|
||
</script>
|