feat(RenderTable): 优化表格操作列按钮样式和布局

-调整按钮样式,增加字体图标和对齐方式
-优化按钮悬浮状态样式
-改进表格操作列的渲染逻辑
- 统一操作列按钮样式
This commit is contained in:
陈昱达
2025-04-23 16:26:34 +08:00
parent ee1666095f
commit 425cbe7621
5 changed files with 67 additions and 40 deletions

View File

@@ -12,6 +12,45 @@ const RenderSlot = {
}
},
render: (h, data) => {
const renderTooltip = first => {
return h(
'el-tooltip',
{
props: {
placement: 'bottom-end',
content: first[0].data.props.title,
effect: 'light'
}
},
first
)
}
const renderPopver = other => {
return h(
'el-popover',
{
props: {
placement: 'bottom-end',
width: '100',
trigger: 'hover',
popperClass: 'table-popver'
},
class: 'table-popver',
scopedSlots: {
reference: () =>
h('el-button', {
props: {
size: 'mini',
type: 'text',
icon: 'el-icon-more'
},
class: 'normal-button'
})
}
},
other
)
}
const params = {
row: data.props.row,
index: data.props.index
@@ -30,44 +69,21 @@ const RenderSlot = {
first[0].data.class = 'normal-button'
first[0].data.props.type = null
first[0].data.props.size = null
other.forEach(item => {
item.data.class = 'normal-button popver-button'
})
const renderPopver = () => {
return h(
'el-popover',
{
props: {
placement: 'top-start',
width: '100',
trigger: 'click',
popperClass: 'table-popver'
},
class: 'table-popver',
scopedSlots: {
reference: () =>
h('el-button', {
props: {
size: 'mini',
type: 'text',
icon: 'el-icon-more'
},
class: 'normal-button'
})
}
},
other
)
}
content.children = [...first, renderPopver()]
content.children = [renderTooltip(first), renderPopver(other)]
return content
} else {
return data.props.render(h, params)
}
const first = contentDiv.splice(0, 1)
first[0].data.class = 'normal-button'
first[0].data.props.type = null
first[0].data.props.size = null
content.children = [renderTooltip(first)]
return content
}
// let div =
} else {
return data.props.render(h, params)