智慧园区前端大屏
src/hooks/initMap.js
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2024-10-25 15:09:55
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2024-10-28 19:42:36
 * @LastEditTime: 2024-11-04 18:08:12
 * @FilePath: \bigScreen\src\hooks\initMap.js
 * @Description: 
 * 
@@ -10,11 +10,11 @@
 */
let viewer = null
const { VITE_APP_BASE } = import.meta.env
import { useMap } from 'store/map'
import { nextTick } from 'vue'
export function readyViewer () {
  const Cesium = DC.getLib('Cesium')
  const { appContext } = getCurrentInstance()
  const store = useMap()
@@ -23,16 +23,26 @@
    nextTick(() => {
      DC.ready({
        baseUrl: `${VITE_APP_BASE}/libs/dc-sdk/resources/`
        baseUrl: `${VITE_APP_BASE}libs/dc-sdk/resources/`
      }).then(() => {
        viewer = new DC.Viewer('viewer-container')
        const global = appContext.config.globalProperties
        global.$viewer = viewer
        store.setLoadMap(true)
        global.$viewer.zoomToPosition(new DC.Position(
          115.1048036679409,
          27.276835758787513,
          4000,
          0,
          -90,
          0
        ), () => {
          store.setLoadMap(true)
        })
      })
    })
  }