jinx 11 月之前
父節點
當前提交
133afb1839
共有 3 個文件被更改,包括 22 次插入6 次删除
  1. 12 2
      src/components/files/TagManager.vue
  2. 6 2
      src/components/files/TagView.vue
  3. 4 2
      src/pages/Viewer.vue

+ 12 - 2
src/components/files/TagManager.vue

@@ -2,16 +2,26 @@
     <div xui_tags_view>
         <TagItem v-for="(tag, index) in tags" :tag="tag" :index="index + 1" @action="onAction" :class="{ active: notify && notify.sid == tag.sid }" />
         <TagEditor v-if="notify && isEdit" :notify="notify" @action="onAction" />
-        <TagView v-if="notify && !isEdit" :notify="notify" />
+        <TagView ref="tagViewer" v-if="notify && !isEdit" :notify="notify" />
     </div>
     <Toast v-if="showTips" v-bind="toastOps" :content="showTips" :close="() => (showTips = null)" />
 </template>
 <script setup>
-import { inject, watch, computed, ref } from 'vue'
+import { inject, watch, computed, ref, defineExpose } from 'vue'
 import TagItem from './TagItem.vue'
 import TagEditor from './TagEditor.vue'
 import TagView from './TagView.vue'
 import Toast from '@/components/dialog/Toast'
+const tagViewer = ref(null)
+
+const onClose = () => {
+    if (tagViewer.value) {
+        tagViewer.value.onClose()
+    }
+}
+defineExpose({
+    onClose,
+})
 let timer = setInterval(() => {
     if (window.kankan) {
         init(window.kankan)

+ 6 - 2
src/components/files/TagView.vue

@@ -16,7 +16,7 @@
     </div>
 </template>
 <script setup>
-import { ref, onMounted, onBeforeUnmount, computed, inject, watch } from 'vue'
+import { ref, onMounted, onBeforeUnmount, computed, inject, watch, defineExpose } from 'vue'
 
 import TagMsg from './content/TagMsg.vue'
 import Comment from './content/Comment.vue'
@@ -27,6 +27,7 @@ const notify = inject('notify')
 const emits = defineEmits(['action'])
 const height = ref(0)
 const canShow = ref(false)
+
 const onResize = () => {
     height.value = window.innerHeight - 90
 }
@@ -73,7 +74,7 @@ const goFocusTag = () => {
     }
 }
 onMounted(() => {
-  goFocusTag()
+    goFocusTag()
     onResize()
     window.addEventListener('resize', onResize)
 })
@@ -81,6 +82,9 @@ onMounted(() => {
 onBeforeUnmount(() => {
     window.removeEventListener('resize', onResize)
 })
+defineExpose({
+    onClose,
+})
 </script>
 <style lang="scss" scoped>
 .aside-item {

+ 4 - 2
src/pages/Viewer.vue

@@ -102,7 +102,7 @@
                     <span>{{ $t('home.fullScreen') }}</span>
                 </div>
             </div>
-            <TagManager />
+            <TagManager ref="tagManager" />
         </main>
     </article>
     <Toast v-if="showTips" type="warn" :content="showTips" :close="() => (showTips = null)" />
@@ -133,7 +133,7 @@ const isFlying = ref(false)
 const editTagId = ref(null)
 const isAuth = ref(false)
 const source = ref(null)
-
+const tagManager = ref(null)
 provide('tags', tags)
 provide('notify', notify)
 provide('isEdit', isEdit)
@@ -441,6 +441,7 @@ const onSelected = data => {
 }
 
 const onPrevDate = name => {
+    tagManager.value.onClose()
     let scene = null
     if (name == 'source') {
         scene = source
@@ -474,6 +475,7 @@ const onPrevDate = name => {
     scene.value = scenes.value[index]
 }
 const onNextDate = name => {
+    tagManager.value.onClose()
     let scene = null
     if (name == 'source') {
         scene = source