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);
        },
相关推荐
徐小夕1 小时前
我用 AI 撸了个开源"万能预览器":浏览器直接打开 Office、CAD 和 3D 模型
前端·vue.js·github
小码哥_常1 小时前
Flutter Android 延迟加载代码指南:提升应用性能的关键
前端
这是个栗子2 小时前
TypeScript(三)
前端·javascript·typescript·react
kvo7f2JTy2 小时前
基于机器学习算法的web入侵检测系统设计与实现
前端·算法·机器学习
北风toto2 小时前
前端CSS样式详细笔记
前端·css·笔记
nanfeiyan2 小时前
git commit
前端
前端精髓4 小时前
移除 Effect 依赖
前端·javascript·react.js
码云之上5 小时前
从一个截图函数到一个 npm 包——pdf-snapshot 的诞生记
前端·node.js·github
码事漫谈5 小时前
AI提效,到底能强到什么程度?
前端·后端
IT_陈寒5 小时前
React hooks依赖数组这个坑差点把我埋了
前端·人工智能·后端