hi-ucs/front/src/App.vue

57 lines
1.4 KiB
Vue
Raw Normal View History

2022-06-14 09:32:49 +08:00
<!--
* @Author: hisense.wuhongjian
* @Date: 2022-05-06 11:12:00
2022-07-21 15:36:01 +08:00
* @LastEditors: hisense.liangjunhua
2022-07-21 16:20:09 +08:00
* @LastEditTime: 2022-07-21 16:00:17
2022-06-14 09:32:49 +08:00
* @Description: 告诉大家这是什么
-->
<template>
<div id="vue-admin-beautiful">
<a-config-provider :locale="locale">
<router-view />
</a-config-provider>
</div>
</template>
2022-07-21 15:36:01 +08:00
<script setup>
2022-06-14 09:32:49 +08:00
import zhCN from 'ant-design-vue/es/locale/zh_CN'
2022-07-21 15:36:01 +08:00
import Cookies from 'js-cookie'
import { onBeforeUnmount } from 'vue'
import mybus from '@/myplugins/mybus'
2022-06-14 09:32:49 +08:00
2022-07-21 15:36:01 +08:00
// export default {
// name: 'App',
// data() {
// return {
// ,
// }
// },
// }
const locale = zhCN
const token = Cookies.get('ucsToken')
console.log('token=================>', token)
var ws = new WebSocket(
`ws://${window.SITE_CONFIG['websocketURL']}/websocket?token=${token}`
)
// ws.send()给服务器发送信息
// 服务器每次返回信息都会执行一次onmessage方法
ws.onmessage = function (e) {
console.log('服务器返回的信息: ' + e.data)
mybus.emit('getMynotice')
2022-06-14 09:32:49 +08:00
}
2022-07-21 15:36:01 +08:00
onBeforeUnmount(() => {
// 4.卸载前, 关闭链接
ws.close()
})
2022-06-14 09:32:49 +08:00
</script>
<style lang="less">
@import '~@/vab/styles/vab.less';
2022-07-20 15:01:14 +08:00
#vue-admin-beautiful {
2022-06-21 17:06:05 +08:00
max-width: 1920px;
2022-07-06 18:42:23 +08:00
// max-height: 1080px;
2022-06-21 17:06:05 +08:00
margin: auto;
height: 100%;
position: relative;
2022-07-20 15:01:14 +08:00
background-color: #fff;
2022-06-21 17:06:05 +08:00
}
2022-06-14 09:32:49 +08:00
</style>