fix:bug解决

This commit is contained in:
李伊帆
2026-10-28 10:36:39 +08:00
parent c369127166
commit 91bca314ba
57 changed files with 2839 additions and 384 deletions

View File

@@ -21,28 +21,36 @@
v-if="pickerOpen"
class="device-header__mask"
@tap="closePicker"
@touchmove.stop.prevent="preventTouchMove"
/>
<view v-if="pickerOpen" class="device-header__dropdown">
<view
v-for="home in homes"
:key="String(home.id)"
class="device-header__option"
:class="{ 'device-header__option--active': isActiveHome(home) }"
@tap.stop="onSelectHome(home)"
<scroll-view
class="device-header__dropdown-scroll"
scroll-y
:show-scrollbar="false"
:style="dropdownScrollStyle"
>
<text
class="device-header__option-text"
:class="{ 'device-header__option-text--active': isActiveHome(home) }"
<view
v-for="home in homes"
:key="String(home.id)"
class="device-header__option"
:class="{ 'device-header__option--active': isActiveHome(home) }"
@tap.stop="onSelectHome(home)"
>
{{ home.homeName || '我的家' }}
</text>
<image
v-if="isActiveHome(home)"
class="device-header__check-icon"
:src="staticAssets.iconHomeSelected"
mode="aspectFit"
/>
</view>
<text
class="device-header__option-text"
:class="{ 'device-header__option-text--active': isActiveHome(home) }"
>
{{ home.homeName || '我的家' }}
</text>
<image
v-if="isActiveHome(home)"
class="device-header__check-icon"
:src="staticAssets.iconHomeSelected"
mode="aspectFit"
/>
</view>
</scroll-view>
<view class="device-header__option device-header__option--manage" @tap.stop="selectManage">
<text class="device-header__option-text">家庭管理</text>
</view>
@@ -79,7 +87,7 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { computed, ref, watch } from 'vue'
import { hasUnreadMessages } from '@/hooks/use-message-inbox'
import type { AppHomeVo } from '@/types/location'
import { parseId, sameId } from '@/utils/device-id'
@@ -97,12 +105,29 @@ const emit = defineEmits<{
scan: []
manage: []
'select-home': [home: AppHomeVo]
'picker-open-change': [open: boolean]
}>()
/** 单行选项约 88rpx,列表最多展示约 8 行高度 */
const DROPDOWN_ITEM_RPX = 88
const DROPDOWN_LIST_MAX_RPX = 704
const dropdownScrollStyle = computed(() => {
const count = Math.max(props.homes.length, 1)
const heightRpx = Math.min(count * DROPDOWN_ITEM_RPX, DROPDOWN_LIST_MAX_RPX)
return { height: `${uni.upx2px(heightRpx)}px` }
})
const pickerOpen = ref(false)
const addMenuOpen = ref(false)
const hasUnreadNotify = hasUnreadMessages
watch(pickerOpen, (open) => {
emit('picker-open-change', open)
})
function preventTouchMove() {}
const sys = uni.getSystemInfoSync()
const statusBarHeight = sys.statusBarHeight ?? 0
const headerPaddingTop =
@@ -225,6 +250,13 @@ function onScan() {
background: #fff;
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1);
z-index: 300;
display: flex;
flex-direction: column;
}
.device-header__dropdown-scroll {
flex-shrink: 0;
width: 100%;
}
.device-header__option {