9433cfb9创建于 2025年12月31日历史提交
<template>
	<scroll-view style="flex: 1;" :scroll-top="scrollTop">
		<view id="testView" class="btn-plus">
		</view>
		<view style="width: 100%; height: 2000px;" @click="checkTestView"></view>
	</scroll-view>
</template>

<script>
	export default {
		data() {
			return {
        scrollTop:0
			}
		},
		methods: {
			checkTestView():boolean {
				let ele = uni.getElementById('testView') as UniElement
				console.log(ele.getBoundingClientRect().y)
        // TODO 鸿蒙低版本偏差稍大
				return ele.getBoundingClientRect().y > 98
			}
		}
	}
</script>

<style>
	.btn-plus {
		position: fixed;
		top: 100px;
		left: 10px;
		width: 50px;
		height: 50px;
		background-color: red;
		box-shadow: 0px 0px 0px rgba(0, 0, 0, 1);
	}
</style>