Jack_Hu
Jack_Hu
  • 发布:2020-03-17 22:18
  • 更新:2020-03-19 07:27
  • 阅读:2298

NVUE为什么固定在底部后,justify-content: center无效

分类:nvue
<template>  
    <view>  
        <view class="tabbar-background">  
            <view class="scan-background"></view>  
        </view>  
    </view>  
</template>  

<script>  
    export default {  

    }  
</script>  

<style>  
    .tabbar-background {  
        /* #ifndef APP-PLUS-NVUE */  
        display: flex;  
        box-sizing: border-box;  
        /* #endif */  
        flex-direction: row;  
        justify-content: center;  
    }  

    .scan-background {  
        /* #ifndef APP-PLUS-NVUE */  
        display: flex;  
        box-sizing: border-box;  
        /* #endif */  
        width: 120rpx;  
        height: 120rpx;  
        border-radius: 50%;  
        box-shadow: 0px -3px 10px 0px rgba(204, 204, 204, 0.5);  
    }  
</style>  

以上样式只要改为
.tabbar-background {
/ #ifndef APP-PLUS-NVUE /
display: flex;
box-sizing: border-box;
/ #endif /
flex-direction: row;
justify-content: center;
position: fixed;
bottom: 0;
}
scan-background 就不会居中了

2020-03-17 22:18 负责人:无 分享
已邀请:
Jack_Hu

Jack_Hu (作者)

问题出在没有设置宽度,所以没有居中。

.tabbar-background {  
/ #ifndef APP-PLUS-NVUE /  
display: flex;  
box-sizing: border-box;  
/ #endif /  
flex-direction: row;  
justify-content: center;  
position: fixed;  
width: 750rpx;  
bottom: 0;  
}

问题解决。

看来dcloud的论坛不够活跃啊

该问题目前已经被锁定, 无法添加新回复