|
|
@@ -126,18 +126,15 @@ export default {
|
|
|
|
|
|
this.socket.on("msg", async (data) => {
|
|
|
const key = data.type
|
|
|
- switch (key) {
|
|
|
- case "offer":
|
|
|
- await this.Peer.setRemoteDescription(data);
|
|
|
- const answer = await this.Peer.createAnswer();
|
|
|
- await this.Peer.setLocalDescription(answer);
|
|
|
- case 'power':
|
|
|
- console.log("电量", data);
|
|
|
- case 'speed':
|
|
|
- const d = Math.floor(data.data)
|
|
|
- this.SpeedValue = d
|
|
|
- default:
|
|
|
- break;
|
|
|
+ if (key === 'offer') {
|
|
|
+ await this.Peer.setRemoteDescription(data);
|
|
|
+ const answer = await this.Peer.createAnswer();
|
|
|
+ await this.Peer.setLocalDescription(answer);
|
|
|
+ } else if (key === 'power') {
|
|
|
+ console.log("电量", data);
|
|
|
+ } else if (key === 'speed') {
|
|
|
+ const d = Math.floor(data.data)
|
|
|
+ this.SpeedValue = d
|
|
|
}
|
|
|
});
|
|
|
|