|
@@ -1,6 +1,6 @@
|
|
|
<script setup>
|
|
|
-import { ref, watch } from "vue";
|
|
|
-import { useRoute, onBeforeRouteLeave } from "vue-router";
|
|
|
+import { ref, watch, nextTick } from "vue";
|
|
|
+import { useRoute } from "vue-router";
|
|
|
|
|
|
const route = useRoute();
|
|
|
const imgBg = ref("");
|
|
@@ -9,16 +9,16 @@ watch(
|
|
|
() => route.query.imgBg,
|
|
|
(e) => {
|
|
|
if (e) {
|
|
|
- // 刷新收藏
|
|
|
- imgBg.value = route.query.imgBg;
|
|
|
+ nextTick(() => {
|
|
|
+ imgBg.value = route.query.imgBg;
|
|
|
+ });
|
|
|
}
|
|
|
+ },
|
|
|
+ {
|
|
|
+ immediate: true,
|
|
|
+ deep: true,
|
|
|
}
|
|
|
);
|
|
|
-
|
|
|
-
|
|
|
-onBeforeRouteLeave(() => {
|
|
|
- imgBg.value = "";
|
|
|
-});
|
|
|
</script>
|
|
|
|
|
|
<template>
|