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