vue-captcha-code
vue-captcha-code
基于 vue
和 canvas
的一个验证码组件
安装
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>
`,
});
在线示例
Dependencies
Dependencies
@babel/core: ^7.12.10@storybook/addon-actions: ^6.1.14@storybook/addon-essentials: ^6.1.14@storybook/addon-links: ^6.1.14@storybook/vue: ^6.1.14@vue/cli-plugin-babel: ~4.5.0@vue/cli-plugin-eslint: ~4.5.0@vue/cli-service: ~4.5.0babel-eslint: ^10.1.0babel-loader: ^8.2.2eslint: ^6.7.2eslint-plugin-vue: ^6.2.2vue-template-compiler: ^2.6.11