templateF.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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" ></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. console.log(item.linkType);
  51. if (item.adsImage === '' && item.linkType === -1) {
  52. return
  53. }else if(item.linkType === -1){
  54. uni.navigateTo({
  55. url:`/h5/pages/activity/activity-detail?adsImage=${item.adsImage}&title=${item.name}`
  56. })
  57. }else{
  58. caimeiApi.FlooryNavigateTo(item)
  59. }
  60. }
  61. }
  62. }
  63. </script>
  64. <style lang="scss">
  65. .picture{
  66. .section{
  67. width: 702rpx;
  68. height: 340rpx;
  69. overflow: hidden;
  70. border-radius: 16rpx;
  71. margin-top: 24rpx;
  72. &:first-child{
  73. margin-top: 0;
  74. }
  75. image{
  76. width: 702rpx;
  77. height: 340rpx;
  78. }
  79. }
  80. }
  81. </style>