Browse Source

答题防止连点

master
kola-web 4 months ago
parent
commit
a9dd6ff57b
  1. 2
      src/pages/my/index.ts
  2. 5
      src/pages/topic/index.ts

2
src/pages/my/index.ts

@ -83,9 +83,7 @@ Page({
this.setData({ this.setData({
toastShow: false, toastShow: false,
}); });
setTimeout(() => {
wx.showTabBar({}); wx.showTabBar({});
}, 1000);
}, },
handleTopic() { handleTopic() {
wx.navigateTo({ wx.navigateTo({

5
src/pages/topic/index.ts

@ -1,4 +1,5 @@
const app = getApp<IAppOption>(); const app = getApp<IAppOption>();
const licia = require('miniprogram-licia');
Page({ Page({
data: { data: {
@ -29,7 +30,7 @@ Page({
}); });
}); });
}, },
handleBtn(e) { handleBtn: licia.debounce(function (e) {
const { index, id } = e.currentTarget.dataset; const { index, id } = e.currentTarget.dataset;
const { question, nav } = this.data; const { question, nav } = this.data;
question[index].answer = id; question[index].answer = id;
@ -38,7 +39,7 @@ Page({
nav: nav === question.length - 1 ? nav : nav + 1, nav: nav === question.length - 1 ? nav : nav + 1,
percentage: ((nav + 1) / question.length) * 100, percentage: ((nav + 1) / question.length) * 100,
}); });
}, }, 200),
handlePrev() { handlePrev() {
this.setData({ this.setData({
nav: this.data.nav - 1, nav: this.data.nav - 1,

Loading…
Cancel
Save