Commit 79ca1b6f authored by 耿迪迪's avatar 耿迪迪

消息提醒问题修改

parent ec4e716d
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<el-dropdown trigger="click" :popper-append-to-body="false" style="height: 30px"> <el-dropdown trigger="click" :popper-append-to-body="false" style="height: 30px">
<div> <div>
<el-badge :value= "this.msgInfo.length" :max="99" class="messageMark"> <el-badge :value= "this.msgInfo.length>0 ? this.msgInfo.length>0 : ''" :max="99" class="messageMark">
   <!--<i class="el-icon-chat-dot-round" />-->    <!--<i class="el-icon-chat-dot-round" />-->
<i class="el-icon-message-solid messageDing"/> <i class="el-icon-message-solid messageDing"/>
 </el-badge>  </el-badge>
...@@ -44,16 +44,17 @@ ...@@ -44,16 +44,17 @@
name: "message", name: "message",
data(){ data(){
return{ return{
msgInfo: {} msgInfo: []
} }
}, },
created(){ created(){
//登录成功后创建websocket //登录成功后创建websocket
this.$websocket.initWebSocket("ws://localhost:8668/precisionEffect/webSocket/" + this.$store.state.user.roles.join(",") + "/" + this.$store.state.user.userId); this.$websocket.initWebSocket("ws://localhost:8668/precisionEffect/webSocket/" + this.$store.state.user.roles.join(",") + "/" + this.$store.state.user.userId);
this.$websocket.addEvent("onmessage",(msg) =>{ this.$websocket.addEvent("onmessage",(msg) =>{
console.log("您有新的消息请注意接收:", JSON.parse(msg.data)); if(msg.data){
this.msgInfo = JSON.parse(msg.data); console.log("您有新的消息请注意接收:", JSON.parse(msg.data));
console this.msgInfo = JSON.parse(msg.data);
}
}) })
}, },
methods:{ methods:{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment