| | |
| | | <template> |
| | | <div class="custom-panel"> |
| | | <div class="panel-content"> |
| | | <el-button @click="handleSwitchChange" title="开启模型库"> |
| | | </el-button> |
| | | <el-switch |
| | | v-model="isDamEnabled" |
| | | active-text="开挖开启" |
| | |
| | | import { ElSwitch } from 'element-plus'; |
| | | const isDamEnabled = ref(false); |
| | | function handleDamOn() { |
| | | console.log('开挖功能已开启'); |
| | | earthCtrl.factory.createModelLibrary() |
| | | |
| | | } |
| | | |
| | | // 开关关闭时执行的函数 |
| | | function handleDamOff() { |
| | | console.log('开挖功能已关闭'); |
| | | } |
| | | |
| | | // 监听 switch 变化 |
| | | function handleSwitchChange(value) { |
| | | if (value) { |
| | | handleDamOn(); |
| | | } else { |
| | | handleDamOff(); |
| | | } |
| | | } |
| | | </script> |