Vue自定义成功弹窗H5实现类似于小程序的效果

效果图:
javascript 复制代码
<div class="father">
    
      <div class="success-box" v-if="isSuccess">
            <img src="../../assets/insure/success-logo.png" alt="">
            <span>{{ successTitle }}</span>
        </div>
</div>
    .father{
     position: relative;
    }
    .success-box {
        width: 130px;
        height: 130px;
        border-radius: 8px;
        background: rgba(64, 64, 64, 0.88);
        display: flex;
        justify-content: center;
        flex-direction: column;
        align-items: center;
        gap: 21px;
        position: absolute;
        top: 50%;
        left: 50%;
        margin-left: -65px;
        margin-top: -65px;
        color: #FFF;
        text-align: center;
        font-family: "PingFang SC";
        font-size: 14px;
        font-style: normal;
        font-weight: 600;
        line-height: normal;
    }
方法代码:

弹出后,两秒后消失

javascript 复制代码
        ensurePass() {
            this.successTitle = '申请成功'
            this.isSuccess = true; //提交成功显示弹窗
            setTimeout(() => {
                this.isSuccess = false; //2s后自动关闭
            }, 2000);
        },
相关推荐
灵感__idea1 天前
Hello 算法:让前端人真正理解算法
前端·javascript·算法
向葭奔赴♡1 天前
CSS是什么?—— 网页的“化妆师”
前端·css
黑犬mo1 天前
在Edge、Chrome浏览器上安装uBlock Origin插件
前端·edge
excel1 天前
🧩 Vue 3 watch 源码详解(含完整注释)
前端·javascript·vue.js
大前端helloworld1 天前
前端梳理体系从常问问题去完善-网络篇
前端·面试
excel1 天前
🌿 一文看懂 Vue 3 的 watch 源码:从原理到流程
前端
繁依Fanyi1 天前
让工具说话:我在 Inspira Board 里用 AI 把“能用、好用、可复用”落成了日常
前端
weixin_456904271 天前
C# 中的回调函数
java·前端·c#
pearbing1 天前
B站排名优化:知识、娱乐、生活类内容的差异化实操策略
人工智能·微信·小程序·生活·娱乐
流***陌1 天前
旧物新生:一款回收小程序如何让环保成为举手之劳
小程序