Files
chengkong-huakaiwuye/huakai-app/App.vue
2026-07-25 11:38:26 +08:00

51 lines
1.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup>
import { onLaunch, onShow } from '@dcloudio/uni-app'
import { captureAppLaunchData } from '/pageSubPack/api/appLaunch.js'
onLaunch(() => {
console.log('App 启动')
// 捕获 App 跳转传入的支付参数(冷启动)
captureAppLaunchData()
// #ifdef APP-PLUS
getPushCID()
// #endif
})
onShow((options) => {
console.log('App onShow, options:', JSON.stringify(options))
// 捕获 App 跳转传入的支付参数(热启动 — options 携带新的 referrerInfo)
captureAppLaunchData(options)
})
// 获取 uniPush 2.0 CID
function getPushCID() {
uni.getPushClientId({
success: (res) => {
console.log('推送初始化成功, CID =', res.cid)
uni.setStorageSync('push_cid', res.cid)
},
fail: (err) => {
console.error('获取推送 CID 失败', err)
}
})
}
</script>
<style lang="scss">
@import "@/uni_modules/uview-plus/index.scss";
</style>
<style>
.uni-toast {
padding: 5px !important;
min-height: auto !important;
box-sizing: border-box !important;
}
.uni-toast-content {
padding: 0 !important;
white-space: normal !important;
word-break: break-all !important;
}
</style>