12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <script>
- // import WebSocketManager from '@/utils/WebSocketManager.js';
- import { watch } from 'vue';
- import store from '@/store'
- export default {
- data:{
- userId: uni.getStorageSync('userId') //读取本地存储
- },
- onLaunch: function () {
- console.log('App Launch')
-
- },
- onShow: function () {
- console.log('App Show')
- },
- onHide: function () {
- console.log('App Hide')
- },
- watch: {
- userId: {
- handler() {
- // console.log('yong---------------',this.userId);
- // const wsManager = new WebSocketManager(this.userId);
- // // 设置消息回调
- // wsManager.onMessage(data => {
- // console.log('app-接收到的消息:', data);
- // // 处理消息逻辑
- // if(data.type === 'msgUnreadCount'){
- // store.dispatch('handleMessageCount',data.data)
- // }
- // });
- // // 建立连接
- // wsManager.connect();
- },
- immediate: true,
- deep: true
- }
- },
- onMounted() {
- console.log("TCL: onMounted -> onMounted", onMounted)
-
- },
- }
- </script>
- <style lang="scss">
- @import "uview-plus/index.scss";
- @import '@/static/scss/index.scss';
- </style>
|