Преглед на файлове

update: more菜单内无按钮时隐藏

wzl преди 1 месец
родител
ревизия
966c079818
променени са 1 файла, в които са добавени 6 реда и са изтрити 1 реда
  1. 6 1
      packages/webview/src/components/Dropdown/Dropdown.vue

+ 6 - 1
packages/webview/src/components/Dropdown/Dropdown.vue

@@ -9,7 +9,7 @@
     :z-index="4"
   >
     <template #trigger>
-      <Button class="more" :class="{ active: showDropdown, disabled: !load }">
+      <Button v-show="!isNoItems" class="more" :class="{ active: showDropdown, disabled: !load }">
         <More /><Arrow />
       </Button>
     </template>
@@ -62,6 +62,11 @@
   const showDropdown = computed(() => popover.value && popover.value.getMergedShow())
   const load = computed(() => useViewer.getUpload)
   const themeMode = computed(() => useViewer.getThemeMode)
+  const isNoItems = computed(() => {
+    const dropDownItems = ['downloadButton', 'flattenButton', 'printButton', 'settingButton']
+    isMobileDevice && dropDownItems.push('themeMode', 'pageModeButton')
+    return prop.rightItems.filter((item) => dropDownItems.includes(item.type) || (item.name === 'customButton' && item.dropItem)).every(item => item.hidden)
+  })
 
   watch(() => popoverChanged.value, (newValue, oldValue) => {
     if (newValue) {