From eec3a2185262535f6ef9167eaa6c34f322aea356 Mon Sep 17 00:00:00 2001 From: owen Date: Thu, 7 Dec 2023 16:25:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=90=A5=E9=94=80=EF=BC=9A=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E8=A3=85=E4=BF=AE=E7=BC=96=E8=BE=91=E5=99=A8=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DiyEditor/index.vue | 11 +++--- src/layout/components/AppView.vue | 13 ++++++- .../mall/promotion/diy/template/decorate.vue | 36 ++++++++++++++++--- 3 files changed, 51 insertions(+), 9 deletions(-) diff --git a/src/components/DiyEditor/index.vue b/src/components/DiyEditor/index.vue index 44cb10a7..1c0119fb 100644 --- a/src/components/DiyEditor/index.vue +++ b/src/components/DiyEditor/index.vue @@ -102,8 +102,8 @@ @@ -306,9 +306,12 @@ const handleDeleteComponent = (index: number) => { // 工具栏操作 const emits = defineEmits(['reset', 'preview', 'save', 'update:modelValue']) + +// 注入无感刷新页面函数 +const reload = inject<() => void>('reload') // 重置 const handleReset = () => { - message.warning('开发中~') + if (reload) reload() emits('reset') } // 预览 diff --git a/src/layout/components/AppView.vue b/src/layout/components/AppView.vue index ffdf11f5..44341873 100644 --- a/src/layout/components/AppView.vue +++ b/src/layout/components/AppView.vue @@ -20,6 +20,17 @@ const getCaches = computed((): string[] => { }) const tagsView = computed(() => appStore.getTagsView) + +//region 无感刷新 +const routerAlive = ref(true) +// 无感刷新,防止出现页面闪烁白屏 +const reload = () => { + routerAlive.value = false + nextTick(() => (routerAlive.value = true)) +} +// 为组件后代提供刷新方法 +provide('reload', reload) +//endregion