templateF.vue 1.5 KB

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