<view class=“test" catchtouchmove style="top:{{topHeight}}px;right:{{rightPosition}}px">
</view>
lifetimes: {
// 在组件实例进入页面节点树时执行
attached() {
const { height, top, right } = wx.getMenuButtonBoundingClientRect();
const width = wx.getSystemInfoSync().windowWidth;
this.setData({
topHeight: height + top + 13,
rightPosition: width - right
});
}
}
小程序获取胶囊位置,并根据胶囊位置设置定位
最新推荐文章于 2025-03-08 13:33:34 发布