index.vue 3.1 KB

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