Git Product home page Git Product logo

vue-drag-verify's Introduction

基于vue-drag-verify二次开发的vue组件

需对父元素或html设置user-select: none

demo

使用方法
  1. 引入升级包

    a. 使用npm(暂不支持vue3)

    // 基本滑块验证组件
    npm i vue-drag-verify2 -S
    // 图片滑块组件
    npm i vue-drag-verify-img -S
    // 基本滑块验证组件(拼图)
    npm i vue-drag-verify-img-chip -S
    // 旋转图片滑块组件
    npm i vue-drag-verify-img-rotate -S
    

    b. 按需引入对应组件(支持vue3,适合二次开发)

    // 基本滑块验证组件
    import dragVerify from "@/components/dragVerify";
    // 图片滑块组件
    import dragVerifyImg from "@/components/dragVerifyImg";
    // 图片滑块组件(拼图)
    import dragVerifyImgChip from "@/components/dragVerifyImgChip";
    // 旋转图片滑块组件
    import dragVerifyImgRotate from "@/components/dragVerifyImgRotate";
    
    components{
       dragVerify,
       dragVerifyImg,
       dragVerifyImgChip,
       dragVerifyImgRotate
    }
    
  2. 引入以下代码

main

<drag-verify
  ref="dragVerify"
  :isPassing.sync="isPassing2"
  text="请按住滑块拖动"
  successText="验证通过"
  handlerIcon="el-icon-d-arrow-right"
  successIcon="el-icon-circle-check"
  >
</drag-verify>

main

<drag-verify-img 
  ref="dragVerify"
  :imgsrc="img"
  :isPassing.sync="isPassing"
  :showRefresh="true"
  text="请按住滑块拖动"
  successText="验证通过"
  handlerIcon="el-icon-d-arrow-right"
  successIcon="el-icon-circle-check"
  @refresh="reimg"
  @passcallback="pass"
  >
</drag-verify-img>

main

如图片与项目非同源,需要图片服务设置header("Access-Control-Allow-Origin: *");

<drag-verify-img-chip 
  ref="dragVerify"
  :imgsrc="img"
  :isPassing.sync="isPassing"
  :showRefresh="true"
  text="请按住滑块拖动"
  successText="验证通过"
  handlerIcon="el-icon-d-arrow-right"
  successIcon="el-icon-circle-check"
  @refresh="reimg"
  @passcallback="pass"
  >
</drag-verify-img-chip>

main

<drag-verify-img-rotate 
  ref="dragVerify"
  :imgsrc="img"  
  :isPassing.sync="isPassing"
  :showTips="true"
  text="请按住滑块拖动"
  successText="验证通过"
  handlerIcon="el-icon-d-arrow-right"
  successIcon="el-icon-circle-check"
  @refresh="reimg"
  >
</drag-verify-img-rotate>

vue3使用

  1. .sync :isPassing.sync="isPassing2" v-model:isPassing="isPassing2"
  2. v-slot <i slot="textBefore"></i> <template #slot><i></i></template>

vue-drag-verify's People

Contributors

yimijianfang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.