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);
        },
相关推荐
C_心欲无痕5 小时前
前端实现水印的两种方式:SVG 与 Canvas
前端·安全·水印
尾善爱看海7 小时前
不常用的浏览器 API —— Web Speech
前端
美酒没故事°8 小时前
vue3拖拽+粘贴的综合上传器
前端·javascript·typescript
jingling5559 小时前
css进阶 | 实现罐子中的水流搅拌效果
前端·css
zhengxianyi51510 小时前
只需3句让Vue3 打包部署后通过修改配置文件修改全局变量——实时生效
vue.js·前后端分离·数据大屏·ruoyi-vue-pro优化
悟能不能悟11 小时前
前端上载文件时,上载多个文件,但是一个一个调用接口,怎么实现
前端
咖啡の猫11 小时前
微信小程序WXSS 模板样式
微信小程序·小程序
可问春风_ren11 小时前
前端文件上传详细解析
前端·ecmascript·reactjs·js
羊小猪~~12 小时前
【QT】--文件操作
前端·数据库·c++·后端·qt·qt6.3
晚风资源组13 小时前
CSS文字和图片在容器内垂直居中的简单方法
前端·css·css3