图文验证:使用canvas(3)

2023-12-28 18:30:52
<template>
  <div>
    <h3>图文验证:使用canvas(3)</h3>
    <div @click="getRefreshCodeFun">
      <verify
        :verifyCode="verifyCode"
        :verifyCodes="verifyCodes"
        style="cursor: pointer"
      ></verify>
    </div>
  </div>
</template>

<script>
import verify from "./verifyDemo.vue";
export default {
  name: "index",
  components: {
    verify,
  },
  data() {
    return {
      verifyCode: "",
      // 验证码规则
      verifyCodes: "123456789ABCDEFGHGKMNPQRSTUVWXYZ",
    };
  },
  methods: {
    // 切换验证码
    getRefreshCodeFun() {
      this.verifyCode = "";
      this.getrandomCode(this.verifyCodes, 4);
      console.log(this.verifyCode);
    },
    // 生成随机验证码
    getrandomCode(o, l) {
      for (let i = 0; i < l; i++) {
        this.verifyCode +=
          this.ve

文章来源:https://blog.csdn.net/jieweiwujie/article/details/135244280
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。