12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <template>
- <view class="picture">
- <view class="section" v-for="(item,index) in productList" :key="index" @click="navigaitionTo(item)">
- <image :src="item.appletsImage" mode="heightFix"></image>
- </view>
- </view>
- </template>
- <script>
- import caimeiApi from '@/common/config/caimeiApi.js'
- export default{
- data(){
- return{
- productList:[]
- }
- },
- props:{
- pageData: {
- type: Object
- },
- userIdentity: {
- type: Number
- },
- flag:{
- type:Boolean,
- default:false
- }
- },
- created() {
- this.initData(this.pageData);
- },
- watch: {
- pageData: {
- handler: function(el) {
- //监听对象的变换使用 function,箭头函数容易出现this指向不正确
- this.pageData = el
- this.initData(this.pageData)
- },
- deep: true
- }
- },
- methods:{
- initData(data){
- if(this.flag){
- this.productList = data.floorImageList;
- }else{
- this.productList = data.floorImageList.slice(0,1);
- }
- },
- navigaitionTo(item){
- if (item.adsImage === '' && item.linkType === -1) {
- return
- }else if(item.linkType === -1){
- uni.navigateTo({
- url:`/h5/pages/activity/activity-detail?adsImage=${item.adsImage}&title=${item.name}`
- })
- }else{
- caimeiApi.FlooryNavigateTo(item)
- }
- }
- }
- }
- </script>
- <style lang="scss">
- .picture{
- .section{
- width: 702rpx;
- height: 340rpx;
- overflow: hidden;
- border-radius: 16rpx;
- margin-top: 24rpx;
- &:first-child{
- margin-top: 0;
- }
- image{
- width: 702rpx;
- height: 340rpx;
- }
- }
- }
- </style>
|