titles.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <!-- 标题 -->
  3. <view v-show="!isSortType">
  4. <view v-if="titleConfig" :style="'margin:0 '+prConfig*2+'rpx;'">
  5. <view @click="goLink" :url="linkConfig" 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. </view>
  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. goLink(){
  42. this.$util.JumpPath(this.linkConfig);
  43. }
  44. }
  45. }
  46. </script>
  47. <style lang="scss">
  48. .title{
  49. font-size: 40rpx;
  50. color: #282828;
  51. text-align: center;
  52. width: 100%;
  53. padding: 20rpx;
  54. box-sizing: border-box;
  55. &.left{
  56. text-align: left;
  57. }
  58. &.right{
  59. text-align: right;
  60. }
  61. &.blod{
  62. font-weight: bold;
  63. }
  64. &.italics{
  65. font-style: italic;
  66. }
  67. }
  68. </style>