40 lines
770 B
Vue
Raw Normal View History

2024-06-17 08:38:39 +08:00
<template>
2024-06-28 10:23:50 +08:00
<button @click="test">anniu</button>
2024-06-27 14:00:57 +08:00
2024-06-17 08:38:39 +08:00
</template>
2024-06-28 10:23:50 +08:00
2024-06-17 08:38:39 +08:00
<script setup>
2024-06-27 10:34:22 +08:00
import Push from "@/utils/push.js"
import {
2024-06-28 10:23:50 +08:00
ref,
reactive
} from "vue"
2024-06-27 10:34:22 +08:00
import {
config
} from "@/config/app.js"
let timerInvol = null
// 开起一个scoket监听用户知否支付成功
const connection = new Push({
url: config.WSS_URL, // websocket地址
app_key: '2ce3ce22329517213caa7dad261f5695',
});
2024-06-28 10:23:50 +08:00
const user_channel = connection.subscribe(`wechat_mmp_9`);
2024-06-27 10:34:22 +08:00
user_channel.on('message', function(data) {
2024-06-28 10:23:50 +08:00
console.log(111111, timerInvol)
clearTimeout(timerInvol);
console.log(222222, timerInvol)
// setImmediate()
2024-06-27 10:34:22 +08:00
});
// 结束
2024-06-28 10:23:50 +08:00
const test = () => {
timerInvol = setTimeout(() => {
console.log("支付超时")
}, 5000)
2024-06-27 10:34:22 +08:00
2024-06-17 15:29:52 +08:00
}
2024-06-17 08:38:39 +08:00
</script>
2024-06-28 10:23:50 +08:00
<style>
2024-06-17 08:38:39 +08:00
</style>