buddhism/components/tile-grid/tile-grid.vue
2025-08-01 09:02:11 +08:00

61 lines
1.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="tile-grid">
<view class="tile-item" v-for="(item, index) in tileCount" :key="index">
<image :src="tileImageSrc" mode="aspectFit" class="tile-image"></image>
</view>
</view>
</template>
<script>
import CommonEnum from '@/enum/common.js';
export default {
name: 'TileGrid',
data() {
return {
CommonEnum,
}
},
props: {
// 瓦片数量
tileCount: {
type: Number,
default: 10
},
// 瓦片图片URL如果不传则使用默认瓦片
tileImage: {
type: String,
default: ''
}
},
computed: {
// 瓦片图片源优先使用传入的tileImage否则使用默认瓦片
tileImageSrc() {
return this.tileImage || this.CommonEnum.TILE
}
}
}
</script>
<style lang="scss" scoped>
.tile-grid {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
box-sizing: border-box;
}
.tile-item {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
}
.tile-image {
width: 75rpx;
height: 48rpx;
}
</style>