美文网首页WEB前端程序开发uni-app让前端飞
前端Vue自定义发送短信验证码弹框popup 实现剩余秒数计数

前端Vue自定义发送短信验证码弹框popup 实现剩余秒数计数

作者: 前端组件分享 | 来源:发表于2023-06-26 04:35 被阅读0次

前端Vue自定义发送短信验证码弹框popup 实现剩余秒数计数 重发短信验证码, 请访问uni-app插件市场地址:https://ext.dcloud.net.cn/plugin?id=13207

效果图如下:

实现代码如下:

# cc-codeDialog

#### 使用方法

```使用方法

<!-- show:是否显示弹框 phone:手机号  autoCountdown:自动时间秒数 len:短信验证码长度 @closeClick:关闭弹框 @confirmClick:确认事件 -->

<cc-codeDialog :show="show" phone="1900000000" :autoCountdown="true" :len="6" @closeClick="closeCodeDialog" @confirmClick="confirmClick"></cc-codeDialog>

```

#### HTML代码实现部分

```html

<template>

<view class="content">

<button @click="showCodeDialog" style="margin-top: 39px;">发送短信验证码 </button>

<!-- show:是否显示弹框 phone:手机号  autoCountdown:自动时间秒数 len:短信验证码长度 @closeClick:关闭弹框 @confirmClick:确认弹框 -->

<cc-codeDialog :show="show" phone="1900000000" :autoCountdown="true" :len="6" @closeClick="closeCodeDialog"

@confirmClick="confirmClick"></cc-codeDialog>

</view>

</template>

<script>

export default {

data() {

return {

show: false

}

},

methods: {

showCodeDialog(item) {

this.show = true;

},

closeCodeDialog(item) {

this.show = false;

},

confirmClick(result) {

console.log("result = " + JSON.stringify(result));

this.show = false;

}

}

}

</script>

<style>

.content {

display: flex;

flex-direction: column;

background-color: aliceblue;

height: 100vh;

}

</style>

```

相关文章

网友评论

    本文标题:前端Vue自定义发送短信验证码弹框popup 实现剩余秒数计数

    本文链接:https://www.haomeiwen.com/subject/amviydtx.html