1
wangjuncheng
2025-06-06 7217e02e098b94e421b5a85ec13e0cd2ed35fbeb
src/components/tools/Dam.vue
@@ -1,39 +1,29 @@
<template>
  <div class="custom-panel">
    <div class="panel-content">
      <el-switch
        v-model="isDamEnabled"
        active-text="开挖开启"
        inactive-text="开挖关闭"
        @change="handleSwitchChange"
      />
      <el-button @click="openModelDialog">
        开启模型库
      </el-button>
    </div>
  </div>
</template>
<script setup>
import { ref } from 'vue';
import { ElSwitch } from 'element-plus';
const isDamEnabled = ref(false);
function handleDamOn() {
  console.log('开挖功能已开启');
  window.Viewer = earthCtrl.viewer;
  earthCtrl.factory.createModelLibrary()
}
// 开关关闭时执行的函数
function handleDamOff() {
  console.log('开挖功能已关闭');
}
// 监听 switch 变化
function handleSwitchChange(value) {
function openModelDialog(value) {
  if (value) {
    handleDamOn();
  } else {
    handleDamOff();
  }
}
</script>
<style scoped>