40 lines
770 B
Vue
40 lines
770 B
Vue
<template>
|
|
|
|
<button @click="test">anniu</button>
|
|
|
|
</template>
|
|
|
|
<script setup>
|
|
import Push from "@/utils/push.js"
|
|
import {
|
|
ref,
|
|
reactive
|
|
} from "vue"
|
|
import {
|
|
config
|
|
} from "@/config/app.js"
|
|
let timerInvol = null
|
|
// 开起一个scoket监听用户知否支付成功
|
|
const connection = new Push({
|
|
url: config.WSS_URL, // websocket地址
|
|
app_key: '2ce3ce22329517213caa7dad261f5695',
|
|
});
|
|
const user_channel = connection.subscribe(`wechat_mmp_9`);
|
|
user_channel.on('message', function(data) {
|
|
console.log(111111, timerInvol)
|
|
clearTimeout(timerInvol);
|
|
console.log(222222, timerInvol)
|
|
// setImmediate()
|
|
});
|
|
// 结束
|
|
|
|
const test = () => {
|
|
timerInvol = setTimeout(() => {
|
|
console.log("支付超时")
|
|
}, 5000)
|
|
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
</style> |