RecommendItem.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <view class="container">
  3. <view class="content">
  4. <view class="img-box">
  5. <!-- <image :src="error || !loaded ? 'https://cdn.uviewui.com/uview/album/10.jpg' : item.logo" mode="scaleToFill" /> -->
  6. <image class='img' :src="item.logo " mode="scaleToFill" />
  7. <view class="name u-line-1">{{ item.name }}</view>
  8. </view>
  9. <view class="pd-10">{{ item.address }}</view>
  10. <view class="pd-10">{{ item.distance | mToKm }}</view>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. props: {
  17. item: {
  18. type: Object,
  19. default: () => {},
  20. },
  21. },
  22. filters: {
  23. mToKm(v) {
  24. return (Number(v) / 1000).toFixed(2) + 'km';
  25. },
  26. },
  27. };
  28. </script>
  29. <style lang="scss" scoped>
  30. .container {
  31. width: 100%;
  32. padding: 20rpx;
  33. box-sizing: border-box;
  34. .content {
  35. background-color: #ffffff;
  36. width: 100%;
  37. height: 400rpx;
  38. .img-box {
  39. position: relative;
  40. height: 240rpx;
  41. .img {
  42. width: calc(50vw - 30rpx);
  43. height: 240rpx;
  44. border-radius: 10rpx;
  45. }
  46. .name {
  47. width: 100%;
  48. position: absolute;
  49. bottom: 0;
  50. left: 0;
  51. background-color: rgba(0, 0, 0, 0.2);
  52. color: #ffffff;
  53. padding: 10rpx;
  54. box-sizing: border-box;
  55. display: inline-block;
  56. white-space: nowrap;
  57. overflow: hidden;
  58. text-overflow: ellipsis;
  59. }
  60. }
  61. .pd-10 {
  62. padding: 10rpx;
  63. }
  64. }
  65. }
  66. </style>