Files
xdd-uniapp-new/pages/home/components/culture.vue
T
2024-11-15 10:39:59 +08:00

70 lines
1.2 KiB
Vue

<template>
<view>
<view class="culture v12-d-grid-columns-2">
<view class="img-item " v-for="(item, index) in list" :key="index">
<image class="img-item" :src="item" mode="widthFix|heightFix" lazy-load="false"></image>
</view>
</view>
<image
v-if="list.length === 0"
:src="webUrl + '/20231023131208675588.png'"
class="img-nodata"
mode="scaleToFill"
/>
</view>
</template>
<script>
import {
getCulture,
} from "@/api/product"
export default {
props: {
landmarkDataId: null
},
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
list: []
}
},
watch: {
landmarkDataId(value) {
if(value) {
this.getData()
}
}
},
mounted() {
this.getData()
},
methods: {
getData() {
getCulture({landmarkDataId: this.landmarkDataId}).then(res => {
this.list = res.data.cultureImages
})
}
}
}
</script>
<style lang="scss" scoped>
.culture{
grid-gap: 20rpx 20rpx;
padding: 20rpx;
}
.img-item{
width: 340rpx;
height: 320rpx;
border-radius: 16rpx;
}
.img-nodata {
position: relative;
top: 0;
left: 50%;
transform: translate(-50%, 0);
width: 352rpx;
height: 338rpx;
margin-bottom: 60rpx;
}
</style>