复制即用

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>同步执行 密码弹出框</title>
    <link rel="stylesheet" href="../css/element-index.css">
    <script type="text/javascript" src="../js/vue.js"></script>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script type="text/javascript" src="../js/element-index.js"></script>
</head>
<body>
<div id="app" v-cloak></div>

</body>
<script>
    var data = {

    }
    //VUE内容实现
    var vue = new Vue({
        el: '#app',
        data: data,
        //初始加载
        async created() {
            for (let i = 1; i <= 2; i++) {
                await this.$prompt('请输入密码:', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    inputType: 'password',
                }).then(({value}) => {
                    Vue.prototype.$message({
                        type: 'success',
                        message: value
                    });
                }).catch(({value}) => {
                    Vue.prototype.$message({
                        type: 'error',
                        message: "你已取消当前操作"
                    });
                    return;
                });
            }
        },
        methods: {
        }
    })
</script>
</html>

js包 自取 地址 请点击!

异步请去掉 async 和 await

Logo

前往低代码交流专区

更多推荐