1
wangjuncheng
2025-06-06 7217e02e098b94e421b5a85ec13e0cd2ed35fbeb
src/components/tools/Dam.vue
@@ -1,14 +1,9 @@
<template>
  <div class="custom-panel">
    <div class="panel-content">
      <el-button @click="handleSwitchChange" title="开启模型库">
      <el-button @click="openModelDialog">
        开启模型库
      </el-button>
      <el-switch
        v-model="isDamEnabled"
        active-text="开挖开启"
        inactive-text="开挖关闭"
        @change="handleSwitchChange"
      />
    </div>
  </div>
</template>
@@ -17,18 +12,18 @@
<script setup>
import { ref } from 'vue';
import { ElSwitch } from 'element-plus';
const isDamEnabled = ref(false);
function handleDamOn() {
  window.Viewer = earthCtrl.viewer;
  earthCtrl.factory.createModelLibrary()
}
// 监听 switch 变化
function handleSwitchChange(value) {
function openModelDialog(value) {
  if (value) {
    handleDamOn();
  }
}
</script>
<style scoped>