detailsA.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <view>
  3. <!-- 图片及其他 -->
  4. <view v-if="detail.url">
  5. <view class="wrap" v-if="detail.url">
  6. <u-image @click="upImg(detail.url)" :src="detail.url" mode="widthFix"></u-image>
  7. </view>
  8. <u-card title="习性" margin="0 0 30rpx 0" v-if="detail.habits">
  9. <view class="textContent" slot="body">
  10. {{detail.habits || ''}}
  11. </view>
  12. </u-card>
  13. <u-card title="防治方法" margin="0 0 30rpx 0" v-if="detail.prevention">
  14. <view class="textContent" slot="body">
  15. {{detail.prevention || ''}}
  16. </view>
  17. </u-card>
  18. </view>
  19. <view class="empyt" v-else>
  20. <u-icon name="info-circle-fill" color="#ff9900" size="48"></u-icon>
  21. <text>暂无介绍,正在补充中~</text>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. detail: {
  30. }
  31. }
  32. },
  33. methods: {
  34. upImg(src) {
  35. uni.previewImage({
  36. urls: src,
  37. })
  38. },
  39. },
  40. onLoad(options) {
  41. this.detail = JSON.parse(options.pestName);
  42. uni.setNavigationBarTitle({
  43. title: `${this.detail.title}介绍`
  44. });
  45. },
  46. }
  47. </script>
  48. <style lang="scss">
  49. page {
  50. background: #f7f8fc;
  51. padding: 25rpx;
  52. }
  53. .wrap {
  54. width: 100%;
  55. margin-bottom: 30rpx;
  56. .u-image {
  57. display: block;
  58. margin: 0 auto;
  59. width: 730rpx;
  60. height: 450rpx;
  61. border-radius: 5px;
  62. }
  63. }
  64. .u-card{
  65. margin-bottom: 30rpx;
  66. }
  67. .u-card__body{
  68. border-top: 2rpx solid #e4e7ed;
  69. }
  70. .empyt{
  71. display: flex;
  72. height: 80vh;
  73. flex-direction: column;
  74. justify-content: center;
  75. align-items: center;
  76. }
  77. </style>