Code Monkey home page Code Monkey logo

czq297297 / miitvip-captcha Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lirongtong/miitvip-captcha

0.0 0.0 0.0 369 KB

:sparkling_heart: 基于 Vue3 + Vite + Canvas 开发的滑块验证码 :sparkling_heart: 动态生成验证滑块,结合后端的二次校验,能有效的避免被其他人肆意抓取并模拟验证,进一步提升验证码的的可靠性 :collision: 且能满足大部分用户的不同定制化需求,譬如自定义背景图 / 定制主题色等等 :fire: :fire:

Home Page: https://admin.makeit.vip/components/captcha

License: MIT License

HTML 0.74% Vue 0.77% JavaScript 13.85% TypeScript 54.05% Less 30.59%

miitvip-captcha's Introduction

基于 Vue3.x + Vite2.x 开发,动态生成验证滑块的验证码组件

npm package npm_downloads MIT webpack vue vite axios ant design vue

关于

Makeit Captcha 2.x 滑块验证码组件,基于 Vue3.x + Vite2.x + Canvas 开发,动态生成验证滑块,结合后端进行二次校验,能有效避免被恶意抓取后的模拟验证,进一步提升验证码的可靠性。

✅ 自定义主题配色 🌲

✅ 自定义初始化验证码 💖

✅ 自定义远程校验结果 💥

✅ 动态配置验证码弹窗背景图 🌺

安装

npm i makeit-captcha

使用

import { createApp } from 'vue'
import MakeitCaptcha from 'makeit-captcha'
import 'makeit-captcha/dist/captcha.min.css'
import App from './app.vue'

const app = createApp(App)
app.use(MakeitCaptcha)
app.mount('#app')

示例

<!-- 自定义初始化 / 校验等 -->
<template>
    <div class="mi-captchas">

        <!-- 基础效果 -->
        <mi-captcha ref="captcha" />

        <!-- 手动触发重置 -->
        <a @click="reset">重置</a>

        <!-- 自定义主题色 -->
        <mi-captcha theme-color="#2F9688"
            border-color="#2F9688"
            box-shadow-color="#2F9688" />
        
        <!-- 自定义初始化 / 校验等 -->
        <mi-captcha theme-color="#be6be0"
            init-action="v1/captcha/init"
            @init="initAfter"
            verify-action="v1/captcha/verification"
            :verify-params="params.verify" />
    </div>
</template>

<script setup>
    import { ref, reactive } from 'vue'

    const captcha = ref(null)

    const params = reactive({
        verify: { key: null }
    })
    
    const initAfter = (res) => {
        if (res?.ret?.code === 200) {
            localStorage.setItem('mi-captcha-key', res?.data?.key)
            params.verify.key = res?.data?.key
        }
    }

    const reset = () => {
        console.log('reinitialize')
        captcha.value?.reset(false)
    }
</script>

更多

更多定制化内容及使用请查看在线示例:https://admin.makeit.vip/components/captcha

miitvip-captcha's People

Contributors

lirongtong 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.