diff --git a/frontend/src/hooks/useLeaveUnSaveTip.ts b/frontend/src/hooks/useLeaveUnSaveTip.ts index 24bdcaebd1..61c9077d5e 100644 --- a/frontend/src/hooks/useLeaveUnSaveTip.ts +++ b/frontend/src/hooks/useLeaveUnSaveTip.ts @@ -1,12 +1,26 @@ import { onBeforeRouteLeave } from 'vue-router'; import { useI18n } from '@/hooks/useI18n'; +import type { ModalType } from '@/hooks/useModal'; import useModal from '@/hooks/useModal'; +export interface LeaveProps { + leaveTitle: string; + leaveContent: string; + tipType: ModalType; +} + +const leaveProps: LeaveProps = { + leaveTitle: 'common.unSaveLeaveTitle', + leaveContent: 'common.unSaveLeaveContent', + tipType: 'error', +}; + // 离开页面确认提示 -export default function useLeaveUnSaveTip() { +export default function useLeaveUnSaveTip(leaveProp = leaveProps) { const { openModal } = useModal(); const { t } = useI18n(); + const { leaveTitle, leaveContent, tipType } = leaveProp; const isSave = ref(true); @@ -21,11 +35,11 @@ export default function useLeaveUnSaveTip() { if (!isSave.value) { openModal({ - type: 'error', - title: t('common.unSaveLeaveTitle'), - content: t('common.unSaveLeaveContent'), + type: tipType, + title: t(leaveTitle), + content: t(leaveContent), okText: t('common.leave'), - cancelText: t('common.cancel'), + cancelText: t('common.stay'), okButtonProps: { status: 'normal', }, diff --git a/frontend/src/views/project-management/environmental/components/EnvParamBox.vue b/frontend/src/views/project-management/environmental/components/EnvParamBox.vue index 7ad9c93aab..9e23893255 100644 --- a/frontend/src/views/project-management/environmental/components/EnvParamBox.vue +++ b/frontend/src/views/project-management/environmental/components/EnvParamBox.vue @@ -76,7 +76,7 @@