Files
crmeb-mp/components/BaseTag.vue
karlcarlo a5c5d753b6 feat: 添加静态资源文件及基础组件
- 新增大量图片资源,包括图标、背景图、海报等,用于页面展示
- 添加字体文件及样式配置,支持自定义字体
- 引入 uni-ui 组件库,包括图标、弹窗、日期选择器等常用组件
- 添加网络状态监听、加密工具等基础工具函数
- 配置 Vuex 状态管理,包括购物车数量、热门搜索词等
- 增加页面组件,如用户协议、分销信息、提现状态等
- 配置项目构建和忽略文件,优化开发体验
2026-02-26 17:59:51 +08:00

89 lines
1.6 KiB
Vue

<template>
<view class="base-tag" :class="{middle: size == 'middle'}" v-if="!imgSrc" :style="[tagStyle]" >{{text}}</view>
<image class="img-tag" :class="{'middle-img-tag': size == 'middle'}" :src="imgSrc" mode="heightFix" v-else></image>
</template>
<script>
export default {
name: "tag",
props: {
size: {
// 标签大小 normal, small
type: String,
default: "normal"
},
// 标签内容
text: {
type: String,
default: ""
},
circle: {
type: [Boolean, String],
default: false
},
background: {
type: String,
default: '#e93323'
},
color: {
type: String,
default: '#ffffff'
},
borderColor:{
type: String,
default: ''
},
imgSrc:{
type: String,
default: ''
}
},
computed:{
tagStyle(){
return {
background: this.background,
color: this.color,
border: this.borderColor ? `1rpx solid ${this.borderColor}` : 'none'
}
}
}
};
</script>
<style lang="scss">
.base-tag {
display: flex;
justify-content: center;
align-items: center;
height: 30rpx;
font-size: 18rpx;
padding: 0 8rpx;
color: #333;
border-radius: 4rpx;
background-color: #fff;
margin-right: 8rpx;
box-sizing: border-box;
margin-bottom: 8rpx;
}
.middle{
height: 36rpx;
padding: 0 12rpx;
border-radius: 8rpx;
font-size: 20rpx;
margin-right: 16rpx;
}
.img-tag{
display: block;
height: 30rpx;
border-radius: 4rpx;
margin-right: 14rpx;
box-sizing: border-box;
margin-bottom: 8rpx;
}
.middle-img-tag{
height: 36rpx;
border-radius: 8rpx;
margin-right: 8rpx;
}
</style>