修改mqtt连接方式

This commit is contained in:
GGJ
2024-12-30 10:07:26 +08:00
parent 0f57e4b746
commit 6a06652532
19 changed files with 173 additions and 93 deletions

View File

@@ -790,7 +790,7 @@ const trendRef: any = ref()
//暂态事件组件
const eventRef: any = ref()
const mqttRef = ref()
const url: any = inject('MQTTURL')
const url: any = window.localStorage.getItem('MQTTURL')
const connectMqtt = () => {
if (mqttRef.value) {
if (mqttRef.value.connected) {
@@ -806,6 +806,8 @@ const connectMqtt = () => {
username: 't_user',
password: 'njcnpqs'
}
mqttRef.value = mqtt.connect(url, options)
}
const getRealDataMqttMsg = async () => {