1.安装vue-graphic-verify插件
npm install vue-graphic-verify --save
2.在main.js中引用
import Vue from 'vue'
import {GVerifyPlugin} from 'vue-graphic-verify'
Vue.use(GVerifyPlugin, {
apiAddr: 'http://localhost:8888',
webKey: 'b7db153be64749799ab48a61ebcf7a1c',
verifyWidth: 300
})
3.在template中使用
<template>
<div>
<g-verify ref="gVerifyBtn"
:webKey="webKey"
@verify-callback="recordToken"
:verifyWidth="verifyWidth">
</g-verify>
<button @click.prevent="reset">重置</button>
</div>
</template>
<script>
import gVerify from 'vue-graphic-verify'
export default {
name: 'app',
data () {
return {
webKey: 'b7db153be64749799ab48a61ebcf7a1c',
verifyWidth: '450&#