Browse Source

Signed-off-by: liuboyan <632697560@qq.com>
计时器

liuboyan 4 years ago
parent
commit
bc01e63904
1 changed files with 7 additions and 1 deletions
  1. 7 1
      pagesGood/auctionDetail.vue

+ 7 - 1
pagesGood/auctionDetail.vue

@@ -62,15 +62,21 @@
 					payTime: '竞拍正式开始!\n'
 				}],
 				auctionList: [],
+				timer: null
 			}
 		},
 		onLoad(options) {
 			this.goodId = options.goodId
 			this.getAuctionData()
-			setInterval(() => {
+		},
+		onShow() {
+			this.timer = setInterval(() => {
 				this.getAuctionData()
 			}, 5000)
 		},
+		onHide() {
+			clearInterval(this.timer)
+		},
 		methods: {
 			//  获取拍卖详情
 			getAuctionData() {