浏览代码

解决横竖屏切换时候 高度计算不准的问题

黄琪勇 11 月之前
父节点
当前提交
1bdf57355a
共有 1 个文件被更改,包括 8 次插入2 次删除
  1. 8 2
      src/views/creation/index.tsx

+ 8 - 2
src/views/creation/index.tsx

@@ -68,6 +68,8 @@ export default defineComponent({
     const lottieDom = ref()
     const lottieDom1 = ref()
     const lottieDom2 = ref()
+    const mStickyBottom = ref()
+    const mStickyUpward = ref()
     const state = reactive({
       id: route.query.id,
       deleteStatus: false,
@@ -497,6 +499,10 @@ export default defineComponent({
       } catch {
         //
       }
+      requestAnimationFrame(()=>{
+        mStickyBottom.value?.onChnageHeight()
+        mStickyBottom.value?.onChnageHeight()
+      })
     });
 
     onUnmounted(() => {
@@ -669,13 +675,13 @@ export default defineComponent({
         </div>
         {
           !isScreenScroll.value &&
-          <MSticky position="bottom" offsetBottom={state.heightB - 1 + "px"} >
+          <MSticky ref={mStickyUpward} position="bottom" offsetBottom={state.heightB - 1 + "px"} >
             <div class={styles.upward}>
               <img src={iconUpward} />
             </div>
           </MSticky>
         }
-        <MSticky position="bottom" onBarHeight={(height: any) => {
+        <MSticky ref={mStickyBottom} position="bottom" onBarHeight={(height: any) => {
             console.log(height, 'height', height)
             state.heightB = height
         }}>