哪位大哥可以在我下面的基础上给我修改一下呀。
就是需要JS 1秒一次轮询API,取返回json的值,判断JSON里qr_code不为null,执行qr_code的值。继续轮询直至一分钟后无结果停止轮询。提示刷新。
这是我的JS代码
function agreeGotoTb(btn) {
$(btn).attr("disabled", "disabled").val("请等待...");
var app = new Vue({
el: '#app',
data: {
json_file: '',
uuid:'<?php echo $uuid;?>'
},
methods: {
getData: function () {
var self = this;
reqwest({
url: 'http://111.21.189.33:8000/redirect',
type: 'json',
method: 'get',
crossOrigin: true,
data: {uuid:this.uuid},
success: function (resp) {
self.json_file = resp;
window.location.href= self.json_file['qr_code'];
}
})
}
},
created: function () {
this.getData();
}
})
}