解决鸿蒙兼容问题
This commit is contained in:
@@ -93,7 +93,17 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, type PropType, nextTick } from "vue";
|
import { ref, computed, type PropType, nextTick } from "vue";
|
||||||
import { isDark, isEmpty, isMp, isNull, parseClass, parsePt, parseRpx, rpx2px } from "@/cool";
|
import {
|
||||||
|
isDark,
|
||||||
|
isEmpty,
|
||||||
|
isHarmony,
|
||||||
|
isMp,
|
||||||
|
isNull,
|
||||||
|
parseClass,
|
||||||
|
parsePt,
|
||||||
|
parseRpx,
|
||||||
|
rpx2px
|
||||||
|
} from "@/cool";
|
||||||
import type { ClSelectTriggerPassThrough } from "../cl-select-trigger/props";
|
import type { ClSelectTriggerPassThrough } from "../cl-select-trigger/props";
|
||||||
import type { ClPopupPassThrough } from "../cl-popup/props";
|
import type { ClPopupPassThrough } from "../cl-popup/props";
|
||||||
import { t } from "@/locale";
|
import { t } from "@/locale";
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
@refresherabort="onRefresherAbort"
|
@refresherabort="onRefresherAbort"
|
||||||
>
|
>
|
||||||
<!-- 下拉刷新 -->
|
<!-- 下拉刷新 -->
|
||||||
|
<!-- #ifndef APP-HARMONY -->
|
||||||
<view
|
<view
|
||||||
slot="refresher"
|
slot="refresher"
|
||||||
class="cl-list-view__refresher"
|
class="cl-list-view__refresher"
|
||||||
@@ -49,6 +50,7 @@
|
|||||||
<cl-text> {{ refresherText }} </cl-text>
|
<cl-text> {{ refresherText }} </cl-text>
|
||||||
</slot>
|
</slot>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- #endif -->
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<view
|
<view
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { isEmpty, router } from "@/cool";
|
import { isEmpty, isHarmony, router } from "@/cool";
|
||||||
import { computed, getCurrentInstance, nextTick, onMounted, reactive, ref, watch } from "vue";
|
import { computed, getCurrentInstance, nextTick, onMounted, reactive, ref, watch } from "vue";
|
||||||
import { usePage } from "../../hooks";
|
import { usePage } from "../../hooks";
|
||||||
|
|
||||||
@@ -106,6 +106,8 @@ const stickyTop = computed(() => {
|
|||||||
// 获取sticky元素的位置信息,并更新rect
|
// 获取sticky元素的位置信息,并更新rect
|
||||||
function getRect() {
|
function getRect() {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
|
setTimeout(
|
||||||
|
() => {
|
||||||
uni.createSelectorQuery()
|
uni.createSelectorQuery()
|
||||||
.in(proxy)
|
.in(proxy)
|
||||||
.select(".cl-sticky")
|
.select(".cl-sticky")
|
||||||
@@ -125,6 +127,9 @@ function getRect() {
|
|||||||
// top需要减去offsetTop并加上当前滚动距离,保证吸顶准确
|
// top需要减去offsetTop并加上当前滚动距离,保证吸顶准确
|
||||||
rect.top = (node.top ?? 0) - props.offsetTop + scrollTop.value;
|
rect.top = (node.top ?? 0) - props.offsetTop + scrollTop.value;
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
isHarmony() ? 300 : 0
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,10 +161,10 @@ defineExpose({
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.cl-sticky {
|
.cl-sticky {
|
||||||
@apply relative;
|
@apply relative w-full;
|
||||||
|
|
||||||
&.is-active {
|
&.is-active {
|
||||||
@apply fixed;
|
@apply fixed w-full;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user