CameraOptBar.vue 1016 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <div class="opt-container">
  3. <div class="opt-item" :class="{ disabled: props.disabled }" @click="setCamera">
  4. <span>设为默认相机</span>
  5. </div>
  6. </div>
  7. </template>
  8. <script setup lang="ts">
  9. const props = defineProps({
  10. disabled: { type: Boolean, default: () => true },
  11. onSetDefault: { type: Function },
  12. });
  13. const setCamera = () => {
  14. if (!props.disabled) {
  15. props.onSetDefault!();
  16. }
  17. };
  18. </script>
  19. <style scoped lang="scss">
  20. .opt-container {
  21. width: 160px;
  22. padding: 10px;
  23. border-radius: 5px;
  24. background-color: #ffffff;
  25. box-shadow: 5px 5px 5px #a3a5a5;
  26. }
  27. .opt-item {
  28. height: 30px;
  29. font-size: 14px;
  30. color: #404040;
  31. display: flex;
  32. justify-content: flex-start;
  33. align-items: center;
  34. padding-left: 8px;
  35. border-radius: 3px;
  36. cursor: pointer;
  37. &:hover {
  38. background-color: #f1f2f5;
  39. }
  40. }
  41. .disabled {
  42. background-color: #f1f2f5;
  43. color: #bcbdc0;
  44. cursor: not-allowed;
  45. }
  46. </style>