mx-index-menus-item.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <template>
  2. <view class="fx-col fx-cen-cen gap-8 h-[70px]">
  3. <vue-svg-icons v-if="useSvg" :name="icon" :class="svgClass"/>
  4. <uv-image :src="combineOssFile(icon)" :mode="imgMode" :width="imgWidth" :height="imgHeight"/>
  5. <text class="break-keep" :class="titleClass">{{ name }}</text>
  6. </view>
  7. </template>
  8. <script setup>
  9. import {computed} from "vue";
  10. import {combineOssFile, createPropDefine} from "@/utils";
  11. const props = defineProps({
  12. icon: createPropDefine(''),
  13. name: createPropDefine(''),
  14. useSvg: createPropDefine(false, Boolean),
  15. svgClass: createPropDefine('w-100 h-100'),
  16. iconMode: createPropDefine('widthFix'),
  17. iconSize: createPropDefine(42, [Number, String]),
  18. titleClass: createPropDefine('text-main'),
  19. });
  20. const imgMode = computed(() =>
  21. ["widthFix", "heightFix"].includes(props.iconMode)
  22. ? props.iconMode
  23. : "widthFix"
  24. );
  25. const imgWidth = computed(() =>
  26. imgMode.value == "widthFix" ? props.iconSize : "auto"
  27. );
  28. const imgHeight = computed(() =>
  29. imgMode.value == "heightFix" ? props.iconSize : "auto"
  30. );
  31. </script>
  32. <style scoped>
  33. </style>