Переглянути джерело

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

wzl 1 місяць тому
батько
коміт
966c079818

+ 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) {