表格组件

This commit is contained in:
yanran200730
2023-03-15 15:18:19 +08:00
parent 106535fc01
commit 529e0ddccf
7 changed files with 87 additions and 55 deletions

View File

@@ -5,9 +5,9 @@
v-for="(item, index) in header"
:key="index"
:style="{
width: item.width + 'px',
textAlign: item.align,
flex: item.width ? 'inherit' : 1
width: config[index].width ? config[index].width + 'px' : '',
textAlign: config[index].align,
flex: config[index].width ? 'inherit' : 1
}">
{{ item.v }}
</span>
@@ -18,10 +18,10 @@
v-for="(column, i) in item"
:key="i"
:style="{
color: column.color,
textAlign: column.align,
width: column.width + 'px',
flex: column.width ? 'inherit' : 1
color: config[i].color,
textAlign: config[i].align,
width: config[i].width ? config[i].width + 'px' : '',
flex: config[i].width ? 'inherit' : 1
}">
<i v-if="isShowIndex === '1' && i === 0">{{ index + 1 }}</i>
<span :title="column.v">{{ column.v }}</span>
@@ -54,6 +54,11 @@
theme: {
type: String,
default: '0'
},
config: {
type: Array,
default: () => []
}
},
@@ -80,6 +85,7 @@
methods: {
init (value) {
console.log(this.config)
if (!value.length) {
this.header = []
this.body = []