瀏覽代碼

feat: 保存

gemercheung 1 年之前
父節點
當前提交
de2e1911ba
共有 2 個文件被更改,包括 6 次插入4 次删除
  1. 5 3
      src/views/collect-detail.vue
  2. 1 1
      src/views/exhibition-detail.vue

+ 5 - 3
src/views/collect-detail.vue

@@ -32,7 +32,7 @@
 </template>
 
 <script setup>
-import { watchEffect, ref, computed } from "vue";
+import { watchEffect, ref, computed, watch, unref } from "vue";
 import subHeader from "../components/subHeader";
 import sideMenu from "../components/sideMenu";
 import heroSubTitle from "../components/heroSubTitle";
@@ -41,7 +41,7 @@ import { useCollectStore } from "../store/collect";
 const collectStore = useCollectStore();
 const entity = computed(() => collectStore.entity);
 const files = computed(() => collectStore.files);
-const title = ref("collect-detail");
+// const title = ref("collect-detail");
 const props = defineProps({
   id: {
     type: [String, Number],
@@ -51,10 +51,12 @@ const props = defineProps({
 });
 
 watchEffect(() => {
-  document.title = title.value;
   if (props.id) {
     collectStore.getDetail(props.id);
   }
+  if (unref(entity).name) {
+    document.title = unref(entity).name;
+  }
 });
 </script>
 

+ 1 - 1
src/views/exhibition-detail.vue

@@ -72,9 +72,9 @@ const props = defineProps({
 });
 
 watchEffect(() => {
-  document.title = "";
   if (props.id) {
     exhibitionStore.getDetail(props.id);
+    document.title = detail.name;
   }
 });
 </script>