<template>
  <div class="opt-container">
    <div class="opt-item" :class="{ disabled: props.disabled }" @click="setCamera">
      <span>设为默认相机</span>
    </div>
  </div>
</template>

<script setup lang="ts">
  const props = defineProps({
    disabled: { type: Boolean, default: () => true },
    onSetDefault: { type: Function },
  });

  const setCamera = () => {
    if (!props.disabled) {
      props.onSetDefault!();
    }
  };
</script>

<style scoped lang="scss">
  .opt-container {
    width: 160px;
    padding: 10px;
    border-radius: 5px;
    background-color: #ffffff;
    box-shadow: 5px 5px 5px #a3a5a5;
  }

  .opt-item {
    height: 30px;
    font-size: 14px;
    color: #404040;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding-left: 8px;
    border-radius: 3px;
    cursor: pointer;

    &:hover {
      background-color: #f1f2f5;
    }
  }

  .disabled {
    background-color: #f1f2f5;
    color: #bcbdc0;
    cursor: not-allowed;
  }
</style>
