diff --git a/web/src/views/app/IndexView.vue b/web/src/views/app/IndexView.vue index 32d7e98f..f2433070 100644 --- a/web/src/views/app/IndexView.vue +++ b/web/src/views/app/IndexView.vue @@ -5,7 +5,7 @@ defineOptions({ import VersionModal from '@/views/app/VersionModal.vue' -import { NButton, NDataTable, NPopconfirm, NSwitch } from 'naive-ui' +import { NButton, NDataTable, NFlex, NPopconfirm, NSwitch } from 'naive-ui' import { useI18n } from 'vue-i18n' import TheIcon from '@/components/custom/TheIcon.vue' @@ -72,98 +72,102 @@ const columns: any = [ title: t('appIndex.columns.actions'), key: 'actions', width: 280, - align: 'center', hideInExcel: true, render(row: any) { - return [ - row.installed && row.update_exist - ? h( - NPopconfirm, - { - onPositiveClick: () => handleUpdate(row.slug) - }, - { - default: () => { - return t('appIndex.confirm.update', { app: row.name }) + return h( + NFlex, + { + justify: 'center' + }, + [ + row.installed && row.update_exist + ? h( + NPopconfirm, + { + onPositiveClick: () => handleUpdate(row.slug) }, - trigger: () => { - return h( - NButton, - { - size: 'small', - type: 'warning' - }, - { - default: () => t('appIndex.buttons.update'), - icon: renderIcon('material-symbols:arrow-circle-up-outline-rounded', { - size: 14 - }) - } - ) + { + default: () => { + return t('appIndex.confirm.update', { app: row.name }) + }, + trigger: () => { + return h( + NButton, + { + size: 'small', + type: 'warning' + }, + { + default: () => t('appIndex.buttons.update'), + icon: renderIcon('material-symbols:arrow-circle-up-outline-rounded', { + size: 14 + }) + } + ) + } } - } - ) - : null, - row.installed - ? h( - NButton, - { - size: 'small', - type: 'success', - onClick: () => handleManage(row.slug) - }, - { - default: () => t('appIndex.buttons.manage'), - icon: renderIcon('material-symbols:settings-outline', { size: 14 }) - } - ) - : null, - row.installed - ? h( - NPopconfirm, - { - onPositiveClick: () => handleUninstall(row.slug) - }, - { - default: () => { - return t('appIndex.confirm.uninstall', { app: row.name }) + ) + : null, + row.installed + ? h( + NButton, + { + size: 'small', + type: 'success', + onClick: () => handleManage(row.slug) }, - trigger: () => { - return h( - NButton, - { - size: 'small', - type: 'error', - style: 'margin-left: 15px;' - }, - { - default: () => t('appIndex.buttons.uninstall'), - icon: renderIcon('material-symbols:delete-outline', { size: 14 }) - } - ) + { + default: () => t('appIndex.buttons.manage'), + icon: renderIcon('material-symbols:settings-outline', { size: 14 }) } - } - ) - : null, - !row.installed - ? h( - NButton, - { - size: 'small', - type: 'info', - onClick: () => { - versionModalShow.value = true - versionModalOperation.value = '安装' - versionModalInfo.value = row + ) + : null, + row.installed + ? h( + NPopconfirm, + { + onPositiveClick: () => handleUninstall(row.slug) + }, + { + default: () => { + return t('appIndex.confirm.uninstall', { app: row.name }) + }, + trigger: () => { + return h( + NButton, + { + size: 'small', + type: 'error' + }, + { + default: () => t('appIndex.buttons.uninstall'), + icon: renderIcon('material-symbols:delete-outline', { size: 14 }) + } + ) + } } - }, - { - default: () => t('appIndex.buttons.install'), - icon: renderIcon('material-symbols:download-rounded', { size: 14 }) - } - ) - : null - ] + ) + : null, + !row.installed + ? h( + NButton, + { + size: 'small', + type: 'info', + onClick: () => { + versionModalShow.value = true + versionModalOperation.value = '安装' + versionModalInfo.value = row + } + }, + { + default: () => t('appIndex.buttons.install'), + icon: renderIcon('material-symbols:download-rounded', { size: 14 }) + } + ) + : null + ] + ) } } ]