index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <div
  3. style="width: 100%;height: 100%"
  4. class="bs-design-wrap"
  5. :id="'border'+ config.code"
  6. :style="{
  7. opacity: opacity,
  8. borderImageSlice:`${borderArray[0]} ${borderArray[1]} ${borderArray[2]} ${borderArray[3]} fill`,
  9. borderImageWidth:`${borderArray[0]}px ${borderArray[1]}px ${borderArray[2]}px ${borderArray[3]}px`,
  10. }"
  11. >
  12. </div>
  13. </template>
  14. <script>
  15. import { refreshComponentMixin } from 'data-room-ui/js/mixins/refreshComponent'
  16. import { getFileUrl } from 'data-room-ui/js/utils/file'
  17. export default {
  18. name: 'Border14',
  19. components: {
  20. },
  21. mixins: [refreshComponentMixin],
  22. props: {
  23. id:{
  24. type: String,
  25. default: 'name'
  26. },
  27. // 卡片的属性
  28. config: {
  29. type: Object,
  30. default: () => ({})
  31. }
  32. },
  33. data () {
  34. return {
  35. }
  36. },
  37. computed: {
  38. url(){
  39. return require('data-room-ui/BorderComponents/GcBorder16/component.png')
  40. },
  41. opacity () {
  42. return this.config.border.opacity || 100
  43. },
  44. borderArray(){
  45. return this.config.border.borderArray ? this.config.border.borderArray
  46. : [50,50,50,50]
  47. }
  48. },
  49. watch: {
  50. 'config.border.imgUrl': {
  51. handler (val) {
  52. if(val){
  53. let ur=val
  54. if(!val.startsWith('http')){
  55. ur = getFileUrl(val)
  56. }
  57. const a =document.getElementById('border'+ this.config.code)
  58. a.style['border-image-source']=`url(${ur})`
  59. }else{
  60. const a =document.getElementById('border'+ this.config.code)
  61. a.style['border-image-source']=`url(${this.url})`
  62. }
  63. }
  64. }
  65. },
  66. mounted () {
  67. if(this.config.border.imgUrl){
  68. let ur=this.config.border.imgUrl
  69. if(!this.config.border.imgUrl.startsWith('http')){
  70. ur = getFileUrl(this.config.border.imgUrl)
  71. }
  72. const a =document.getElementById('border'+ this.config.code)
  73. a.style['border-image-source']=`url(${ur})`
  74. }else{
  75. const a =document.getElementById('border'+ this.config.code)
  76. a.style['border-image-source']=`url(${this.url})`
  77. }
  78. },
  79. methods: {
  80. }
  81. }
  82. </script>
  83. <style lang="scss" scoped>
  84. .bs-design-wrap {
  85. // border-image-source:url(component.png);
  86. width: 100%;
  87. height: 100%;
  88. position: absolute;
  89. }
  90. /*滚动条样式*/
  91. ::v-deep ::-webkit-scrollbar {
  92. width: 4px;
  93. border-radius: 4px;
  94. height: 4px;
  95. }
  96. ::v-deep ::-webkit-scrollbar-thumb {
  97. background: #dddddd !important;
  98. border-radius: 10px;
  99. }
  100. </style>