dynamic-tag.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <view class="tag-box">
  3. <view class="tag-box-list">
  4. <view class="data-tag" v-for="tag in list" :style="{'background':tagBg}">
  5. <view class="data-tag-icon">
  6. <text class="iconfont icon-dingweixiao" v-if="tag.icon==='1'" :style="{'color':tagColor}"> &#xe87e;</text>
  7. <text class="iconfont icon-canyuhuati" v-else :style="{'color':tagColor}"> &#xe61e;</text>
  8. </view>
  9. <view class="data-tag-text sys-weight-400" :style="{'color':tagColor}">{{tag.text}}</view>
  10. </view>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. name: "dynamic-tag",
  17. components: {},
  18. props: {
  19. list:{
  20. type:Array,
  21. default:[]
  22. },
  23. tagColor:{
  24. type:String,
  25. default:'#282828'
  26. },
  27. tagBg:{
  28. type:String,
  29. default:'rgba(255,255,255,0.4)'
  30. },
  31. },
  32. data() {
  33. return {}
  34. },
  35. watch: {},
  36. mounted() {
  37. },
  38. methods: {}
  39. }
  40. </script>
  41. <style scoped lang="scss">
  42. .tag-box{
  43. .tag-box-list{
  44. display: flex;
  45. flex-wrap: wrap;
  46. .data-tag{
  47. margin-top: 26rpx;
  48. margin-right: 20rpx;
  49. border-radius: 200rpx;
  50. background: rgba(255,255,255,0.4);
  51. display: flex;
  52. justify-content: center;
  53. padding: 4rpx 12rpx;
  54. .data-tag-img{
  55. width: 32rpx;
  56. height: 32rpx;
  57. margin-right: 8rpx;
  58. }
  59. .data-tag-icon{
  60. width: 32rpx;
  61. height: 32rpx;
  62. margin-right: 8rpx;
  63. text-align: center;
  64. line-height: 32rpx;
  65. text{
  66. font-size: 28rpx;
  67. line-height: 32rpx;
  68. }
  69. }
  70. .data-tag-text{
  71. font-size: 24rpx;
  72. height: 32rpx;
  73. line-height: 32rpx;
  74. }
  75. }
  76. }
  77. }
  78. </style>