l-svg.uvue 734 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <template>
  2. <view class="l-svg" :style="svgStyle">
  3. <!-- SVG 占位组件 -->
  4. </view>
  5. </template>
  6. <script setup lang="uts">
  7. type Props = {
  8. src?: string
  9. color?: string
  10. web?: boolean
  11. }
  12. const props = withDefaults(defineProps<Props>(), {
  13. src: '',
  14. color: '',
  15. web: false
  16. })
  17. const emit = defineEmits<{
  18. (e: 'error'): void
  19. (e: 'load'): void
  20. }>()
  21. const svgStyle = computed(() => {
  22. const style: Map<string, any> = new Map()
  23. if (props.color.length > 0) {
  24. style.set('color', props.color)
  25. }
  26. return style
  27. })
  28. </script>
  29. <style lang="scss">
  30. .l-svg {
  31. display: flex;
  32. }
  33. </style>