detail.vue 1003 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <view class="wrapper">
  3. <view class="font6 bold padding14" style="text-align: center;">商品详情</view>
  4. <div v-for="(item, index) in pics" :key="index">
  5. <image-fit :src="item" />
  6. </div>
  7. </view>
  8. </template>
  9. <script>
  10. import imageFit from '@/components/image-fit'
  11. export default {
  12. components: { imageFit },
  13. props: {
  14. data: Object
  15. },
  16. watch: {
  17. data (newValue) {
  18. if (newValue.pic) {
  19. this.pics = newValue.pic.split(',')
  20. } else {
  21. this.pics = []
  22. }
  23. }
  24. },
  25. data () {
  26. return {
  27. pics: []
  28. }
  29. },
  30. mounted () {
  31. if (this.data.pic) {
  32. this.pics = this.data.pic.split(',')
  33. }
  34. }
  35. }
  36. </script>
  37. <style lang="scss" scoped>
  38. .wrapper {
  39. margin-top: 20rpx;
  40. border-radius: 20rpx;
  41. .image {
  42. width: 100%;
  43. height: 540rpx;
  44. }
  45. }
  46. .margin-1 {
  47. margin-top: -1px
  48. }
  49. </style>