Python 爬虫 Selenium 中滑动验证码
免责声明:自本文章发布起, 本文章仅供参考,不得转载,不得复制等操作。浏览本文章的当事人如涉及到任何违反国家法律法规造成的一切后果由浏览本文章的当事人自行承担与本文章博客主无关。以及由于浏览本文章的当事人转载,复制等操作涉及到任何违反国家法律法规引起的纠纷和造成的一切后果由浏览本文章的当事人自行承担与本文章博客主无关。
1. Vue 实现图片滑动验证码
1.1 安装插件
使用 vue-puzzle-vcode 插件:
官方网址: https://gitee.com/beeworkshop/vue-puzzle-vcode/tree/master/
npm install vue-puzzle-vcode --save
1.2 实现例子
设置更多参数看官网
<template>
<div id="app">
<Vcode
:imgs="imgs"
:show="isShow"
@success="success"
@close="close"
/>
<button @click="submit">登录</button>
</div>
</template>
<script>
import Vcode from "vue-puzzle-vcode";
import img1 from "./assets/1.webp";
import img2 from "./assets/2.jpg";
import img3 from "./assets/3.jpg";
import img4 from "./assets/4.jpg";
export default {
data() {
return {
isShow: false, // 验证码模态框是否出现
imgs: [img1, img2, img3, img4] // 验证码模态框背景照片
};
},
components: {
Vcode
},
methods: {
submit() {
this.isShow = true;
},
// 用户通过了验证
success(msg) {
console.log(msg);
this.isShow = false; // 通过验证后,需要手动隐藏模态框
},
// 用户点击遮罩层,应该关闭模态框
close() {
this.isShow = false;
}
}
};
</script>
<style>
#app {
display: flex;
justify-content: center;
align-items: center;
height: 100px;
}
button {
font-size: 25px;
padding: 5px 30px;
border-radius: 0;
background-color: #48a9ff;
border: aliceblue;
cursor: pointer