<template>
    <el-config-provider :locale="zhCn">
        <router-view></router-view>
    </el-config-provider>
</template>

<script lang="ts" setup>
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import useSetTheme from '@/utils/setTheme'
import { provide, onMounted, ref } from 'vue'
//线上mqtt

// let buildUrl = 'wss://pqmcn.com:8087/mqtt'//102
let buildUrl = 'ws://pqmcn.com:8073/mqtt'//27


// 从 Nginx 获取 MQTT URL
const fetchMqttUrl = async () => {

    const response = await fetch('/')
    const mqttUrl = response.headers.get('X-Mqtt-Url')

    window.localStorage.setItem('MQTTURL', mqttUrl || buildUrl)

}

//本地mqtt
// let devUrl = 'ws://192.168.1.24:8085/mqtt' 

onMounted(() => {
    fetchMqttUrl()
})
// provide('MQTTURL', buildUrl.value)
useSetTheme()
</script>

<style lang="scss">
/* Your SCSS styles here */
</style>
