mirror of
https://gitee.com/xuliangzhan_admin/vxe-table.git
synced 2026-01-21 05:27:57 +08:00
107 lines
3.2 KiB
Vue
107 lines
3.2 KiB
Vue
<template>
|
|
<div>
|
|
<p><table-api-link name="vxe-table"/> 静态化基础表格</p>
|
|
|
|
<vxe-table
|
|
:data.sync="tableData">
|
|
<vxe-table-column type="index" width="60"></vxe-table-column>
|
|
<vxe-table-column field="name" title="app.body.label.name"></vxe-table-column>
|
|
<vxe-table-column field="sex" title="app.body.label.sex"></vxe-table-column>
|
|
<vxe-table-column field="age" title="app.body.label.age"></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>使用 <table-api-link prop="highlight-hover-row"/> 属性启用 hover 行高亮</p>
|
|
|
|
<vxe-table
|
|
highlight-hover-row
|
|
:data.sync="tableData">
|
|
<vxe-table-column type="index" title="序号" 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>
|
|
|
|
<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
|
|
:data.sync="tableData">
|
|
<vxe-table-column type="index" width="60"></vxe-table-column>
|
|
<vxe-table-column field="name" title="app.body.label.name"></vxe-table-column>
|
|
<vxe-table-column field="sex" title="app.body.label.sex"></vxe-table-column>
|
|
<vxe-table-column field="age" title="app.body.label.age"></vxe-table-column>
|
|
</vxe-table>
|
|
`,
|
|
`
|
|
export default {
|
|
data () {
|
|
return {
|
|
tableData: []
|
|
}
|
|
},
|
|
created () {
|
|
this.tableData = window.MOCK_DATA_LIST.slice(0, 6)
|
|
}
|
|
}
|
|
`,
|
|
`
|
|
<vxe-table
|
|
highlight-hover-row
|
|
:data.sync="tableData">
|
|
<vxe-table-column type="index" title="序号" 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, 6)
|
|
}
|
|
}
|
|
`
|
|
]
|
|
}
|
|
},
|
|
created () {
|
|
let list = window.MOCK_DATA_LIST.slice(0, 6)
|
|
this.tableData = list
|
|
},
|
|
mounted () {
|
|
Array.from(this.$el.querySelectorAll('pre code')).forEach((block) => {
|
|
hljs.highlightBlock(block)
|
|
})
|
|
}
|
|
}
|
|
</script>
|