|
@@ -11,11 +11,12 @@ const menuBtnClientRect = ref<UniNamespace.GetMenuButtonBoundingClientRectRes>({
|
|
|
const startMenuBtnStyle = ref({
|
|
|
width: '0px',
|
|
|
height: '0px',
|
|
|
- marginLeft: '0px',
|
|
|
+ left: '0px',
|
|
|
+ top: '0px',
|
|
|
})
|
|
|
// 获取小程序胶囊距离
|
|
|
onMounted(async () => {
|
|
|
- const { windowHeight, windowWidth } = await uni.getSystemInfo()
|
|
|
+ const { windowWidth } = await uni.getWindowInfo()
|
|
|
// console.log(windowHeight, windowWidth)
|
|
|
// #ifdef MP-WEIXIN
|
|
|
menuBtnClientRect.value = await uni.getMenuButtonBoundingClientRect()
|
|
@@ -23,7 +24,8 @@ onMounted(async () => {
|
|
|
startMenuBtnStyle.value = {
|
|
|
width: menuBtnClientRect.value.width + 'px',
|
|
|
height: menuBtnClientRect.value.height + 'px',
|
|
|
- marginLeft: `${windowWidth - menuBtnClientRect.value.right}px`,
|
|
|
+ top: `${menuBtnClientRect.value.top}px`,
|
|
|
+ left: `${windowWidth - menuBtnClientRect.value.right}px`,
|
|
|
}
|
|
|
// console.log(startMenuBtnStyle.value)
|
|
|
// #endif
|
|
@@ -31,8 +33,11 @@ onMounted(async () => {
|
|
|
</script>
|
|
|
<template>
|
|
|
<div>
|
|
|
- <div :style="{ height: menuBtnClientRect.top + 'px' }"></div>
|
|
|
- <div class="rounded-full flex items-center px-3 box-border" :style="startMenuBtnStyle">
|
|
|
+ <!-- <div :style="{ height: menuBtnClientRect.top + 'px' }"></div> -->
|
|
|
+ <div
|
|
|
+ class="fixed rounded-full flex items-center px-3 box-border bg-green z-1"
|
|
|
+ :style="startMenuBtnStyle"
|
|
|
+ >
|
|
|
<slot></slot>
|
|
|
</div>
|
|
|
</div>
|