diff --git a/App.vue b/App.vue index e4403f4..e533e63 100644 --- a/App.vue +++ b/App.vue @@ -78,37 +78,41 @@ export default { this.globalData.NativeEvent = false console.log('开始监听宿主消息') - uni.onNativeEventReceive((event, data) => { - if (event) { - console.log('接收到宿主消息:', event, data) + if (typeof uni.onNativeEventReceive === 'function') { + uni.onNativeEventReceive((event, data) => { + if (event) { + console.log('接收到宿主消息:', event, data) - if (event == "token") { - let header = uni.getStorageSync('header') || {} - header["x-token"] = data - uni.setStorageSync('header', header) - console.log('已更新 token') + if (event == "token") { + let header = uni.getStorageSync('header') || {} + header["x-token"] = data + uni.setStorageSync('header', header) + console.log('已更新 token') - //获取宿主用户信息 - try { - this.$getUserInfo() - } catch (error) { - console.error('获取用户信息失败:', error) + //获取宿主用户信息 + try { + this.$getUserInfo() + } catch (error) { + console.error('获取用户信息失败:', error) + } + } else if (event == "jump") { + if (data) { + console.log('接收到跳转指令,已缓存目标地址:', data); + uni.setStorageSync('jumpTarget_url', data); + // 强制重定向到首页,触发onShow获取用户信息后再跳转 + uni.reLaunch({ + url: '/pages/index/index' + }); + } + } else if (event == 'wx_pay_result' || event == 'ios_pay_result') { + this.globalData.recentNativeEvent = event + this.globalData.recentNativeData = data } - } else if (event == "jump") { - if (data) { - console.log('接收到跳转指令,已缓存目标地址:', data); - uni.setStorageSync('jumpTarget_url', data); - // 强制重定向到首页,触发onShow获取用户信息后再跳转 - uni.reLaunch({ - url: '/pages/index/index' - }); - } - } else if (event == 'wx_pay_result' || event == 'ios_pay_result') { - this.globalData.recentNativeEvent = event - this.globalData.recentNativeData = data } - } - }) + }) + } else { + console.log('uni.onNativeEventReceive 不可用,跳过监听') + } } }, diff --git a/components/balance-list/balance-list.vue b/components/balance-list/balance-list.vue index 480819c..5cb9bb0 100644 --- a/components/balance-list/balance-list.vue +++ b/components/balance-list/balance-list.vue @@ -98,7 +98,7 @@ const handleTouchStart = (e, item) => { event: e, item }) - }, 1500) + }, 1000) } const handleTouchMove = (e) => { diff --git a/components/common/auto-width-input.vue b/components/common/auto-width-input.vue index a25414a..3425c1a 100644 --- a/components/common/auto-width-input.vue +++ b/components/common/auto-width-input.vue @@ -7,12 +7,21 @@