| | |
| | | <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> |
| | |
| | | <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> |