This commit is contained in:
@@ -94,8 +94,8 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { h } from 'vue'
|
||||
import { ElButton, ElDropdown, ElDropdownMenu, ElDropdownItem, ElIcon } from 'element-plus'
|
||||
import { ArrowDown } from '@element-plus/icons-vue'
|
||||
import { ElDropdown, ElDropdownMenu, ElDropdownItem } from 'element-plus'
|
||||
|
||||
import { useTableStore } from '@/store/modules/table'
|
||||
const { width } = useWindowSize()
|
||||
const isMobile = computed(() => width.value < 500)
|
||||
@@ -374,20 +374,19 @@
|
||||
)
|
||||
}
|
||||
|
||||
// 如果操作数量 <= inlineActionsCount,直接显示所有按钮
|
||||
// 如果操作数量 <= inlineActionsCount,直接显示所有文本
|
||||
if (actionList.length <= props.inlineActionsCount) {
|
||||
return h(
|
||||
'div',
|
||||
{ style: 'display: flex; gap: 8px;' },
|
||||
actionList.map((action) =>
|
||||
h(
|
||||
ElButton,
|
||||
'span',
|
||||
{
|
||||
type: action.type === 'danger' ? 'danger' : 'primary',
|
||||
link: true,
|
||||
style: `color: ${action.type === 'danger' ? 'var(--el-color-danger)' : 'var(--el-color-primary)'}; cursor: pointer;`,
|
||||
onClick: () => action.handler(row)
|
||||
},
|
||||
() => action.label
|
||||
action.label
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -400,13 +399,12 @@
|
||||
return h('div', { style: 'display: flex; gap: 12px; align-items: center;' }, [
|
||||
...inlineActions.map((action) =>
|
||||
h(
|
||||
ElButton,
|
||||
'span',
|
||||
{
|
||||
type: action.type === 'danger' ? 'danger' : 'primary',
|
||||
link: true,
|
||||
style: `color: ${action.type === 'danger' ? 'var(--el-color-danger)' : 'var(--el-color-primary)'}; cursor: pointer;`,
|
||||
onClick: () => action.handler(row)
|
||||
},
|
||||
() => action.label
|
||||
action.label
|
||||
)
|
||||
),
|
||||
h(
|
||||
@@ -422,7 +420,7 @@
|
||||
style:
|
||||
'display: flex; align-items: center; cursor: pointer; color: var(--el-color-primary);'
|
||||
},
|
||||
[h('span', '更多'), h(ElIcon, { style: 'margin-left: 4px;' }, () => h(ArrowDown))]
|
||||
[h('span', '更多操作')]
|
||||
),
|
||||
dropdown: () =>
|
||||
h(ElDropdownMenu, {}, () =>
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
:total="pagination.total"
|
||||
:marginTop="10"
|
||||
:actions="getActions"
|
||||
:actionsWidth="230"
|
||||
:inlineActionsCount="2"
|
||||
:actionsWidth="220"
|
||||
:inlineActionsCount="3"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user