1. vue-captcha-code

vue-captcha-code

vue-captcha-code

基于 vuecanvas 的一个验证码组件

安装

npm install vue-captcha-code --save

APIS

点这里

基本用法

 import VueCaptcha from 'vue-captcha-code';

const Template = (args, { argTypes }) => ({
  props: Object.keys(argTypes),
  data: function() {
    return {
      code: '',
    };
  },
  components: { VueCaptcha },
  methods: {
    handleChange(code) {
      console.log('code: ', code);
    },
    refresh() {
      this.$refs.captcha.refreshCaptcha();
    },
  },
  template: `
    <div>
      <vue-captcha 
        ref="captcha" 
        :captcha.sync="code"
        @on-change="handleChange">
      </vue-captcha>
      <div>
        <button @click="refresh">刷新</button>
      </div>
    </div>
  `,
});

在线示例

Edit vue-captcha
s