fix: 弹出弹窗逻辑修改

This commit is contained in:
Tim
2025-08-19 21:48:48 +08:00
parent e9458f5419
commit fb89c9fb25
4 changed files with 194 additions and 90 deletions

View File

@@ -1,21 +1,21 @@
<template>
<BasePopup :visible="state.visible" @close="onCancel">
<div class="confirm-dialog">
<h3 class="confirm-title">{{ state.title }}</h3>
<p class="confirm-message">{{ state.message }}</p>
<BasePopup :visible="visible" @close="onCancel">
<div class="confirm-dialog" role="dialog" aria-modal="true">
<h3 class="confirm-title">{{ title }}</h3>
<p class="confirm-message">{{ message }}</p>
<div class="confirm-actions">
<button class="cancel-button" @click="onCancel">取消</button>
<button class="confirm-button" @click="onConfirm">确认</button>
<div class="cancel-button" @click="onCancel">取消</div>
<div class="confirm-button" @click="onConfirm">确认</div>
</div>
</div>
</BasePopup>
</template>
<script setup>
<script setup lang="ts">
import BasePopup from '~/components/BasePopup.vue'
import { useConfirm } from '~/composables/useConfirm'
const { state, onConfirm, onCancel } = useConfirm()
const { visible, title, message, onConfirm, onCancel } = useConfirm()
</script>
<style scoped>
@@ -25,29 +25,47 @@ const { state, onConfirm, onCancel } = useConfirm()
}
.confirm-title {
margin-top: 0;
font-size: 18px;
font-weight: 600;
}
.confirm-message {
margin: 20px 0;
margin: 16px 0 20px;
line-height: 1.6;
color: var(--text-secondary, #666);
}
.confirm-actions {
display: flex;
justify-content: center;
gap: 10px;
gap: 12px;
}
.confirm-button,
.cancel-button {
min-width: 88px;
height: 36px;
padding: 0 14px;
border-radius: 8px;
cursor: pointer;
border: 1px solid transparent;
}
.confirm-button {
background-color: var(--primary-color);
color: white;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
background: var(--primary-color);
color: #fff;
display: flex;
align-items: center;
justify-content: center;
}
.confirm-button:hover {
background: var(--primary-color-hover);
}
.cancel-button {
background-color: #ccc;
color: black;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
background: transparent;
color: var(--primary-color);
border-color: currentColor;
display: flex;
align-items: center;
justify-content: center;
}
</style>
.cancel-button:hover {
opacity: 0.85;
}
</style>