templateF.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <view class="picture">
  3. <view class="section" v-for="(item,index) in productList" :key="index" @click="navigaitionTo(item)">
  4. <image :src="item.appletsImage" mode="heightFix"></image>
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. import caimeiApi from '@/common/config/caimeiApi.js'
  10. export default{
  11. data(){
  12. return{
  13. productList:[]
  14. }
  15. },
  16. props:{
  17. pageData: {
  18. type: Object
  19. },
  20. userIdentity: {
  21. type: Number
  22. },
  23. flag:{
  24. type:Boolean,
  25. default:false
  26. }
  27. },
  28. created() {
  29. this.initData(this.pageData);
  30. },
  31. watch: {
  32. pageData: {
  33. handler: function(el) {
  34. //监听对象的变换使用 function,箭头函数容易出现this指向不正确
  35. this.pageData = el
  36. this.initData(this.pageData)
  37. },
  38. deep: true
  39. }
  40. },
  41. methods:{
  42. initData(data){
  43. if(this.flag){
  44. this.productList = data.floorImageList;
  45. }else{
  46. this.productList = data.floorImageList.slice(0,1);
  47. }
  48. },
  49. navigaitionTo(item){
  50. if (item.adsImage === '' && item.linkType === -1) {
  51. return
  52. }
  53. caimeiApi.FlooryNavigateTo(item)
  54. }
  55. }
  56. }
  57. </script>
  58. <style lang="scss">
  59. .picture{
  60. .section{
  61. width: 702rpx;
  62. height: 340rpx;
  63. overflow: hidden;
  64. border-radius: 16rpx;
  65. margin-top: 24rpx;
  66. &:first-child{
  67. margin-top: 0;
  68. }
  69. image{
  70. width: 702rpx;
  71. height: 340rpx;
  72. }
  73. }
  74. }
  75. </style>