70 lines
1.8 KiB
Vue
70 lines
1.8 KiB
Vue
|
|
<template>
|
|
<view class="grid-card-content-item" @click="$emit('click')">
|
|
<view class="grid-card-content-item-icon" :style="{background:background}">
|
|
<image class="grid-card-content-item-icon-2" mode="aspectFit" :src="src" />
|
|
<view class="grid-card-badge" v-if="badge > 0">{{badge}}</view>
|
|
</view>
|
|
<view class="grid-card-content-item-text">{{text || ''}}</view>
|
|
</view>
|
|
</template>
|
|
<script>
|
|
export default {
|
|
props: ["src", "text", "badge", 'background'],
|
|
data () {
|
|
return {};
|
|
},
|
|
components: {}
|
|
};
|
|
</script>
|
|
<style lang='scss'>
|
|
.grid-card-content-item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
background: $uni-theme-white;
|
|
height: 180rpx;
|
|
|
|
.grid-card-content-item-icon {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
position: relative;
|
|
width: 80rpx;
|
|
height: 80rpx;
|
|
background: $uni-theme-color;
|
|
border-radius: 20rpx;
|
|
|
|
.grid-card-content-item-icon-2 {
|
|
width: 40rpx;
|
|
height: 40rpx;
|
|
}
|
|
|
|
.grid-card-badge {
|
|
box-sizing: border-box;
|
|
position: absolute;
|
|
right: -14rpx;
|
|
top: -14rpx;
|
|
height: 30rpx;
|
|
min-width: 30rpx;
|
|
padding: 0 6rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background: red;
|
|
font-size: 20rpx;
|
|
color: #fff;
|
|
border-radius: 20rpx;
|
|
}
|
|
}
|
|
|
|
.grid-card-content-item-text {
|
|
max-width: 80%;
|
|
text-align: center;
|
|
margin-top: 16rpx;
|
|
color: #111;
|
|
font-size: 24rpx;
|
|
}
|
|
}
|
|
</style> |