HomeButton.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <view
  3. class="position-relative d-flex flex-row justify-center align-center radius-base bg-light-light-primary p-1 pt-25 pb-25 gap-xs"
  4. :style="{
  5. width: size === 100 ? '100%' : `calc(${size}% - 15rpx)`
  6. }"
  7. @click="onClick"
  8. >
  9. <Image :src="icon" width="40rpx" height="40rpx" />
  10. <text class="size-l color-primary">{{ title }}</text>
  11. <Image
  12. v-if="bg" :src="bg"
  13. :width="160"
  14. :height="90"
  15. :innerStyle="{
  16. position: 'absolute',
  17. bottom: 0,
  18. right: 0,
  19. }"
  20. />
  21. </view>
  22. </template>
  23. <script setup lang="ts">
  24. import Image from '@/components/basic/Image.vue';
  25. const props = defineProps({
  26. title: {
  27. type: String,
  28. default: '探索文化地图'
  29. },
  30. bg: {
  31. type: String,
  32. default: ''
  33. },
  34. icon: {
  35. type: String,
  36. default: 'https://mncdn.wenlvti.net/app_static/minnan/images/home/IconMap.png'
  37. },
  38. size: {
  39. type: Number,
  40. default: 100
  41. }
  42. })
  43. const emit = defineEmits(['click'])
  44. const onClick = () => {
  45. emit('click')
  46. }
  47. defineOptions({
  48. options: {
  49. virtualHost: true
  50. }
  51. })
  52. </script>