uniapp pages.json 设置了maxWidth后fixed --window-right失效

258 阅读1分钟

希望相对父级元素固定,而不是相对浏览器固定

pages.json设置了maxWidth:768

设置了--window-right效果如下:

image.png

.share {
    width: 99rpx;
    height: 99rpx;
    position: fixed;
    right: 30rpx;
    bottom: 220rpx;
    background: #fcdb66;
    box-shadow: 0rpx 6rpx 16rpx 0rpx rgba(252, 219, 102, 0.5);
    border-radius: 50%;
    
    // 宽屏处理
    /* #ifdef H5 */
    @media (min-width: 768px) {
        left: 0;
        right: 0;
        margin: 0 auto;
        transform: translateX(235rpx);
    }
    /* #endif */
    
    view {
        text-align: center;
        font-size: 26rpx;
        font-weight: bold;
        color: #1d1d1f;
        line-height: 30rpx;

        &:first-child {
            margin-top: 16rpx;
        }
    }
}

效果图如下:

image.png

参考链接:blog.csdn.net/DDD4V/artic…