使用van-popup修改样式为自定义弹框

html:

<div class="couponContent">
    <van-popup v-model="show" :close-on-click-overlay="false" 
        closeable close-icon-position="bottom" class="popup">
        <div class="couponBox">
            <img :src="merchantInfo.cdn_static+'statistics/ai_img/coupon_bg.png'" />
            <div class="price">
                <span>¥</span>1
            </div>
            <div class="title">测试</div>
        </div>
    </van-popup>
</div>

js:

data () {
    return {
        弹框显示隐藏
        show:true
    }
},

css:

.couponContent {
    z-index: 10;
    position: relative;

    .popup {
        width: 330px;
        height: 306px;
        overflow: hidden;
        background: transparent;
    
        .couponBox {
            width: 320px;
            height: 260px;
            position: relative;
            
            img {
                width: 100%;
                height: 100%;
            }
            
            .price, .title {
                position: absolute;
                left: 50%;
                transform: translateX(-50%);
                font-weight: bold;
                color: #F84301;
            }
            
            .price {
                top: 37px;
                font-size: 32px;
                
                span {
                    font-size: 14px;
                }
            }
            
            .title {
                top: 82px;
                font-size: 14px;
            }
        }
        
        /deep/.van-popup__close-icon {
            background: #FFFFFF; 
            border-radius: 50%;            
            bottom: 0;
            left: 50%;
            transform: translateX(-75%);
            padding: 3px;
        }
    }
}

@media screen and (max-width: 750px) {
    .couponContent {
    
        .popup {
            width: 6.6rem;
            height: 6.12rem;
        
            .couponBox {
                width: 6.4rem;
                height: 5.2rem;
                
                .price {
                    top: 0.74rem;
                    font-size: 0.64rem;
                    
                    span {
                        font-size: 0.28rem;
                    }
                }
                
                .title {
                    top: 1.64rem;
                    font-size: 0.28rem;
                }
            }
            
            /deep/.van-popup__close-icon {
                padding: 0.06rem;
            }
        }
    }
}

效果图:

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值