Browse Source

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

wzl 4 weeks ago
parent
commit
966c079818
1 changed files with 6 additions and 1 deletions
  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"
     :z-index="4"
   >
   >
     <template #trigger>
     <template #trigger>
-      <Button class="more" :class="{ active: showDropdown, disabled: !load }">
+      <Button v-show="!isNoItems" class="more" :class="{ active: showDropdown, disabled: !load }">
         <More /><Arrow />
         <More /><Arrow />
       </Button>
       </Button>
     </template>
     </template>
@@ -62,6 +62,11 @@
   const showDropdown = computed(() => popover.value && popover.value.getMergedShow())
   const showDropdown = computed(() => popover.value && popover.value.getMergedShow())
   const load = computed(() => useViewer.getUpload)
   const load = computed(() => useViewer.getUpload)
   const themeMode = computed(() => useViewer.getThemeMode)
   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) => {
   watch(() => popoverChanged.value, (newValue, oldValue) => {
     if (newValue) {
     if (newValue) {