index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <div
  3. style="width: 100%;height: 100%"
  4. class="bs-design-wrap"
  5. >
  6. <div
  7. :key="updateKey"
  8. class="custom-border-box"
  9. :style="`
  10. border-top-left-radius: ${radiusLeftTop}px;
  11. border-top-right-radius: ${radiusRightTop}px;
  12. border-bottom-left-radius: ${radiusLeftBottom}px;
  13. border-bottom-right-radius: ${radiusRightBottom}px;
  14. border: ${width}px solid ${color};
  15. background-image: linear-gradient(${gradientDirection}, ${
  16. gradientColor0 ? gradientColor0 : gradientColor1
  17. } , ${gradientColor1 ? gradientColor1 : gradientColor0})
  18. `"
  19. >
  20. <div class="element"
  21. v-if="config.border.isTitle"
  22. :style="`
  23. line-height:${config.border.titleHeight}px;
  24. height:${config.border.titleHeight};
  25. border-bottom:3px solid ${fontBottomColor};
  26. background-image: linear-gradient(${gradientDirection}, ${
  27. fontGradientColor0 ? fontGradientColor0 : fontGradientColor1
  28. } , ${fontGradientColor1 ? fontGradientColor1 : fontGradientColor0})
  29. `"
  30. >
  31. <span
  32. :style="`
  33. width:100%;
  34. padding:0 0 0 20px;
  35. color:${fontColor};
  36. font-size:${config.border.fontSize}px;
  37. border-left:${fontLeftWidth}px solid ${fontLeftColor};
  38. `"
  39. >
  40. {{config.title}}
  41. </span>
  42. </div>
  43. </div>
  44. </div>
  45. </template>
  46. <script>
  47. import { refreshComponentMixin } from 'data-room-ui/js/mixins/refreshComponent'
  48. export default {
  49. name: 'Border14',
  50. components: {
  51. },
  52. mixins: [refreshComponentMixin],
  53. props: {
  54. // 卡片的属性
  55. config: {
  56. type: Object,
  57. default: () => ({})
  58. }
  59. },
  60. data () {
  61. return {
  62. }
  63. },
  64. computed: {
  65. fontColor () {
  66. return this.config.border.fontColor ? this.config.border.fontColor
  67. : '#fff'
  68. },
  69. color () {
  70. return this.config.border.borderColor || ''
  71. },
  72. width () {
  73. return this.config.border.borderWidth!=null?this.config.border.borderWidth : 2
  74. },
  75. gradientColor0 () {
  76. return this.config.border.gradientColor0 ||this.config.border.gradientColor1|| 'transparent'
  77. },
  78. gradientColor1 () {
  79. return this.config.border.gradientColor1 ||this.config.border.gradientColor0|| 'transparent'
  80. },
  81. fontGradientColor0 () {
  82. return this.config.border.fontGradientColor0 ||this.config.border.fontGradientColor1|| 'transparent'
  83. },
  84. fontGradientColor1 () {
  85. return this.config.border.fontGradientColor1 ||this.config.border.fontGradientColor0|| 'transparent'
  86. },
  87. fontLeftColor(){
  88. return this.config.border.fontLeftColor || ''
  89. },
  90. fontBottomColor(){
  91. return this.config.border.fontBottomColor || ''
  92. },
  93. fontLeftWidth(){
  94. return this.config.border.fontLeftWidth!=null?this.config.border.fontLeftWidth : 6
  95. },
  96. radiusLeftTop () {
  97. return this.config.border.radiusLeftTop || 2
  98. },
  99. radiusRightTop () {
  100. return this.config.border.radiusRightTop || 2
  101. },
  102. radiusLeftBottom () {
  103. return this.config.border.radiusLeftBottom || 2
  104. },
  105. radiusRightBottom () {
  106. return this.config.border.radiusRightBottom || 2
  107. },
  108. gradientDirection () {
  109. return this.config.border.gradientDirection || 'to right'
  110. },
  111. },
  112. watch: {
  113. },
  114. mounted () {
  115. },
  116. methods: {
  117. }
  118. }
  119. </script>
  120. <style lang="scss" scoped>
  121. .bs-design-wrap {
  122. position: absolute;
  123. width: 100%;
  124. height: 100%;
  125. // padding: 0 16px;
  126. background-color: transparent;
  127. border-radius: 4px;
  128. box-shadow: 0px 0px 0px 0px !important;
  129. box-sizing: border-box;
  130. .custom-border-box {
  131. width: 100%;
  132. height: 100%;
  133. }
  134. }
  135. /*滚动条样式*/
  136. ::v-deep ::-webkit-scrollbar {
  137. width: 4px;
  138. border-radius: 4px;
  139. height: 4px;
  140. }
  141. ::v-deep ::-webkit-scrollbar-thumb {
  142. background: #dddddd !important;
  143. border-radius: 10px;
  144. }
  145. </style>