warningBar.vue 579 B

123456789101112131415161718192021222324252627282930313233
  1. <template>
  2. <div
  3. class="px-1.5 py-2 flex items-center bg-amber-50 rounded gap-2 mb-3 text-amber-500"
  4. :class="href&&'cursor-pointer'"
  5. @click="open"
  6. >
  7. <el-icon class="text-xl">
  8. <warning-filled />
  9. </el-icon>
  10. <span>
  11. {{ title }}
  12. </span>
  13. </div>
  14. </template>
  15. <script setup>
  16. import { WarningFilled } from '@element-plus/icons-vue'
  17. const prop = defineProps({
  18. title: {
  19. type: String,
  20. default: ''
  21. },
  22. href: {
  23. type: String,
  24. default: ''
  25. }
  26. })
  27. const open = () => {
  28. if (prop.href) {
  29. window.open(prop.href)
  30. }
  31. }
  32. </script>