var page = new Vue({
el: '#content-page',
data: {
token: null
},
methods: {},
mounted: function () {
//get token object from API
}
});
该令牌有一个属性syncStatus
,可以是inProgress
或completed
。我想要一个条件轮询,它将继续调用API,直到syncStatus获得完成的值。
我可以做这样的事情:
var page = new Vue({
el: '#content-page',
data: {
token: null
},
methods: {
//Method-get-token
//In axios.then if syncStatus is inProgress call this method again
},
mounted: function () {
//get token object from API
//if syncStatus is inProgress call method-get-token
}
});
但我认为必须有一些更好的方法来做到这一点。
有什么建议?