Merge pull request #2953 from xinnan-tech/fix-modal-flicker

Fix modal flicker
This commit is contained in:
wengzh
2026-02-06 16:40:56 +08:00
committed by GitHub
3 changed files with 10 additions and 5 deletions
@@ -210,6 +210,7 @@ export default {
paramDropdownVisible: false, paramDropdownVisible: false,
voiceCloneDropdownVisible: false, voiceCloneDropdownVisible: false,
userMenuVisible: false, // 添加用户菜单可见状态 userMenuVisible: false, // 添加用户菜单可见状态
menuVisibleTimer: null, // 菜单显示定时器,防止够快触发
isSmallScreen: false, isSmallScreen: false,
// 搜索历史相关 // 搜索历史相关
searchHistory: [], searchHistory: [],
@@ -631,7 +632,12 @@ export default {
// 处理用户菜单可见性变化 // 处理用户菜单可见性变化
handleUserMenuVisibleChange(visible) { handleUserMenuVisibleChange(visible) {
this.userMenuVisible = visible; if (this.menuVisibleTimer) return;
this.menuVisibleTimer = setTimeout(() => {
this.userMenuVisible = visible;
clearTimeout(this.menuVisibleTimer);
this.menuVisibleTimer = null;
}, 100);
// 如果菜单关闭了,也要清空选择值 // 如果菜单关闭了,也要清空选择值
if (!visible) { if (!visible) {
@@ -105,6 +105,7 @@ export default {
}, },
cancel() { cancel() {
this.saving = false; // 取消时重置状态 this.saving = false; // 取消时重置状态
this.dialogKey = Date.now();
this.$emit('cancel'); this.$emit('cancel');
}, },
@@ -115,9 +116,7 @@ export default {
}, },
watch: { watch: {
visible(newVal) { visible(newVal) {
if (newVal) { if (!newVal) {
this.dialogKey = Date.now();
} else {
// 当对话框关闭时,重置saving状态 // 当对话框关闭时,重置saving状态
this.saving = false; this.saving = false;
} }
@@ -153,13 +153,13 @@ export default {
}, },
cancel() { cancel() {
this.saving = false; // 取消时重置状态 this.saving = false; // 取消时重置状态
this.dialogKey = Date.now();
this.$emit('cancel'); this.$emit('cancel');
} }
}, },
watch: { watch: {
visible(newVal) { visible(newVal) {
if (newVal) { if (newVal) {
this.dialogKey = Date.now();
api.agent.getRecentlyFiftyByAgentId(this.agentId, ((data) => { api.agent.getRecentlyFiftyByAgentId(this.agentId, ((data) => {
this.valueTypeOptions = data.data.data.map(item => ({ this.valueTypeOptions = data.data.data.map(item => ({
...item ...item