splash.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const _sfc_main = {
  4. data() {
  5. return {
  6. countdown: 3,
  7. timer: null
  8. };
  9. },
  10. onLoad() {
  11. this.startCountdown();
  12. },
  13. onUnload() {
  14. if (this.timer) {
  15. clearInterval(this.timer);
  16. }
  17. },
  18. methods: {
  19. startCountdown() {
  20. this.timer = setInterval(() => {
  21. this.countdown--;
  22. if (this.countdown <= 0) {
  23. clearInterval(this.timer);
  24. this.skipToLogin();
  25. }
  26. }, 1e3);
  27. },
  28. skipToLogin() {
  29. if (this.timer) {
  30. clearInterval(this.timer);
  31. }
  32. common_vendor.index.reLaunch({
  33. url: "/pages/login/login"
  34. });
  35. }
  36. }
  37. };
  38. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  39. return {
  40. a: common_vendor.t($data.countdown > 0 ? $data.countdown + "s后跳过" : "跳过"),
  41. b: common_vendor.o((...args) => $options.skipToLogin && $options.skipToLogin(...args))
  42. };
  43. }
  44. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-b5d3b004"]]);
  45. wx.createPage(MiniProgramPage);
  46. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/splash/splash.js.map