修复切换页面nan问题

This commit is contained in:
2025-05-08 16:24:39 +08:00
parent 1f59082bcb
commit ac28ee855f
6 changed files with 115 additions and 69 deletions

View File

@@ -72,7 +72,11 @@ const useWebSocket = (options = {}) => {
}
// 关闭现有连接并清理资源
closeExistingConnection();
try{
closeExistingConnection();
}catch(err){
}
socketTask.value = uni.connectSocket({
url: uni.conf.baseUrlwws,
success: (res) => {
@@ -353,7 +357,7 @@ const useWebSocket = (options = {}) => {
connect,
onShowconnect,
initNetworkListener,
connect
connect,allowReconnect
};
};