12345678910111213141516171819202122232425262728293031323334353637383940 |
- import { createSubscribe } from "applet-page-component";
- Component(
- createSubscribe({
- onShow() {},
- })({
- props: {},
- data: {
- isPaySuccess: true,
- sec: 3,
- },
- didMount() {
- this.init();
- },
- methods: {
- init() {
- const _this = this;
- const myInterval = () => {
- if (_this.data.sec > 0) {
- _this.setData({
- sec: _this.data.sec - 1,
- });
- } else {
- clearInterval(myIntervalId);
- // 支付成功后暂时返回首页,方便通过验收
- const len = getCurrentPages().length;
- my.navigateBack({
- delta: len + 1,
- });
- }
- };
- const myIntervalId = setInterval(myInterval, 1000);
- },
- },
- })
- );
|