当前位置: 首页 > news >正文

推荐一款前端滑动验证码插件(Vue、uniapp)

uniapp版本:滑块拼图验证码,有后端,简单几步即可实现,小程序、h5都可以用 - DCloud 插件市场

Vue版本及cdn版本可以查阅文档: 行为验证 | Poster 文档

示例代码:

<template><view id="app"><button @click="open">验证</button><slider-captcha v-model="visible":options="options":loading="loading"@check="check"@close="close"@refresh="getSliderOptions"@error="getSliderOptions"><!-- vue2 --><view slot="title">自定义标题-安全验证</view><view slot="successText">自定义成功提示-登录中</view><view slot="errorText">自定义错误提示-是不是太难了换一个</view><view slot="tips">自定义提示拖动下方滑块完成拼图</view><!-- <view slot="question">自定义提示</view> --><!-- vue2 --><!-- vue3 --><template #title>自定义标题-安全验证</template><template #successText>自定义成功提示-登录中</template><template #errorText>自定义错误提示-是不是太难了换一个</template><template #tips>自定义提示拖动下方滑块完成拼图</template><!-- <template #question>自定义提示</template> --><!-- vue3 --></slider-captcha> </view>
</template><script>
import SliderCaptcha from '@/components/kkokk-slider-captcha.vue'
export default {components:{SliderCaptcha},data(){return {visible: false,loading: false,options: {}}},methods: {// 打开触发open() {this.visible = truethis.getSliderOptions()},// 验证check(sliderKey, sliderX, done, error){// 这里是验证是否成功的接口this.loading = trueuni.request({url: 'http://192.168.10.76:8111/', header: {// 'Content-Type': 'application/x-www-form-urlencoded''Content-Type': 'application/json' //自定义请求头信息},data:{sliderKey:sliderKey,sliderX:sliderX},method:'POST',//请求方式,必须为大写success: (res) => {this.loading = falsedone()},fail: () => {this.loading = falseerror()}})},// 关闭触发close() {},// 获取滑块验证参数getSliderOptions(){this.loading = trueuni.request({url: 'http://192.168.10.76:8111/', header: {// 'Content-Type': 'application/x-www-form-urlencoded''Content-Type': 'application/json' //自定义请求头信息},method:'GET',//请求方式,必须为大写success: (res) => {const {img, key, y} = res.datathis.options = {sliderImg: img,sliderKey: key,sliderY: y}this.loading = false}})}}
}
</script>

使用效果:

唯一不足的是:依赖的后端环境是php 

http://www.lryc.cn/news/410970.html

相关文章:

  • 【Git】git stash
  • 不得不安利的程序员开发神器,太赞了!!
  • 吴恩达机器学习C1W2Lab06-使用Scikit-Learn进行线性回归
  • CSS实现表格无限轮播
  • 编程小白如何从迷茫走出
  • 14 B端产品的运营管理
  • STM32_RTOS学习笔记——1(列表与列表项)
  • 子网划分案例
  • javaweb_02:Maven
  • 19.延迟队列优化
  • P10477 Subway tree systems 题解,c++ 树相关题目
  • 18.jdk源码阅读之CopyOnWriteArrayList
  • 美股:AMD展现乐观前景,挑战AI加速器市场霸主
  • 如何提高计算机视觉技术在复杂环境和低光照条件下的物体识别准确率?
  • ubuntu cmake使用自己版本的qt
  • Python基础知识笔记---保留字
  • Python面试整理-Web开发
  • 民大食堂用餐小程序的设计
  • Linux系统编程(4):消息队列
  • 【初阶数据结构篇】单链表的实现(赋源码)
  • LeetCode 2844.生成特殊数字的最少操作(哈希表 + 贪心)
  • 昇思MindSpore 应用学习-基于 MindSpore 实现 BERT 对话情绪识别
  • 【初阶数据结构篇】顺序表和链表算法题
  • 使用weex进行APP混合开发
  • C++stl大根堆/小根堆的创建与记忆
  • visual studio性能探测器使用案列
  • redis的代码开发
  • 嗷呜,就问你接不接?
  • 避免过拟合,参数大模型强,正则让模型不要走偏
  • vue+element-ui的列表查询条件/筛选条件太多以下拉选择方式动态添加条件(支持全选、反选、清空)