index.vue 3.2 KB

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