首先在index.html引入相應js:
<script src="https://ssl.captcha.qq.com/TCaptcha.js"></script>
然后在對應的頁面創建對象:
mounted: function () {
this.captcha = new window.TencentCaptcha('xxxxx', function (res) {
if (res.ret === 0) {
//執行邏輯
}
})
},