titles.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <!-- 标题 -->
  3. <view v-show="!isSortType">
  4. <view v-if="titleConfig" :style="'margin:0 '+prConfig*2+'rpx;'">
  5. <navigator :url="linkConfig" hover-class="none" class='title' :class="[(textPosition==0?'left':textPosition==2?'right':''),(textStyle==1?'italics':textStyle==2?'blod':''), (bgStyle===0?'':'borderRadius15')]" :style="'font-size:'+fontSize+'rpx;margin-top:'+mbConfig*2+'rpx;background-color:'+titleColor+';color:'+themeColor+';'">
  6. <div>{{titleConfig}}</div>
  7. <slot name="bottom"></slot>
  8. </navigator>
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. name: 'titles',
  15. props: {
  16. dataConfig: {
  17. type: Object,
  18. default: () => {}
  19. },
  20. isSortType:{
  21. type: String | Number,
  22. default:0
  23. }
  24. },
  25. data() {
  26. return {
  27. fontSize:this.dataConfig.fontSize.val*2,
  28. linkConfig:this.dataConfig.linkConfig.value,
  29. mbConfig:this.dataConfig.mbConfig.val,
  30. textPosition:this.dataConfig.textPosition.type,
  31. textStyle:this.dataConfig.textStyle.type,
  32. titleColor:this.dataConfig.titleColor.color[0].item,
  33. titleConfig:this.dataConfig.titleConfig.value,
  34. themeColor:this.dataConfig.themeColor.color[0].item,
  35. prConfig:this.dataConfig.prConfig.val,
  36. bgStyle:this.dataConfig.bgStyle.type
  37. };
  38. },
  39. created() {},
  40. methods: {}
  41. }
  42. </script>
  43. <style lang="scss">
  44. .title{
  45. font-size: 40rpx;
  46. color: #282828;
  47. text-align: center;
  48. width: 100%;
  49. padding: 20rpx;
  50. box-sizing: border-box;
  51. &.left{
  52. text-align: left;
  53. }
  54. &.right{
  55. text-align: right;
  56. }
  57. &.blod{
  58. font-weight: bold;
  59. }
  60. &.italics{
  61. font-style: italic;
  62. }
  63. }
  64. </style>