-
Notifications
You must be signed in to change notification settings - Fork 940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
想问一下在vue2中用axios请求成功后在success函数里面调用停止函数,动画会立即停止,而且指针位置也不对,不放在请求里面就没事 #314
Labels
Comments
可否在 这个demo里 用定时器模拟复现一下这个bug吗 |
在demo里面的定时器是可以的,但是到了真正的请求success函数里面调用就会立即停止,
// 点击抽奖按钮会触发star回调
startCallback () {
if (!this.hasPhone) {
this.$emit('showPhone')
return
}
if (this.luckyData.user_draw_times < 1) {
this.$toast('没有抽奖次数了')
return
}
// 调用抽奖组件的play方法开始游戏
this.$refs.myLucky.play()
this.$axios.post({
url: `/a/lucky/${this.$route.query.luckyid}/draw`,
success: (res) => {
console.log(res)
this.resultobj = res.data
let arr = []
for(let i = 0 ; i < 8 ; i++){
if(this.prizes[i].id == res.data.prize_id){
arr.push(i)
}
}
//arr的数据格式: arr=[0,1,2,3]
arr = this.shuffle(arr)
//这里是不行的,动不到半秒钟就直接停止动画了
// this.$refs.myLucky.stop(arr[0])
//如果放在定时函数里面可以转动,但是时间一到就重现上面的问题了,直接停下来,没有缓动的结束效果以及位置也不对
// setTimeout(()=>{
// this.$refs.myLucky.stop(arr[0])
// },2000)
setTimeout(()=>{
this.$emit('setResult', this.resultobj)
},2000)
},
error:(e)=>{
this.$toast(e.error)
}
})
//如果放到这里是可以的
// setTimeout(()=>{
// this.$refs.myLucky.stop(0)
// },1000)
},
…------------------ 原始邮件 ------------------
发件人: "buuing/lucky-canvas" ***@***.***>;
发送时间: 2022年8月18日(星期四) 晚上6:34
***@***.***>;
***@***.******@***.***>;
主题: Re: [buuing/lucky-canvas] 想问一下在vue2中用axios请求成功后在success函数里面调用停止函数,动画会立即停止,而且指针位置也不对,不放在请求里面就没事 (Issue #314)
可否在 这个demo里 用定时器模拟复现一下这个bug吗
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
我就这么说, 100%是你代码的问题, 如果是这个包的旋转逻辑有问题, 这个项目每个月上千的下载量, 早炸锅了, 你还是仔细检查你的代码吧 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: