index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template >
  2. <div class="border-panel" :style="borderPanelStyle">
  3. <div class="border-panel_header" :style="{
  4. backgroundImage: `url(${headerImageBgUrl})`
  5. }" >
  6. <linear-text :text="title" startColor="#95CCFF" endColor="#fff"
  7. :extClass='{
  8. top: "11px",
  9. left: "35px",
  10. textShadow: "0 1px 1px #0057FF"
  11. }'
  12. />
  13. </div>
  14. <div class="border-panel_content">
  15. <slot></slot>
  16. </div>
  17. </div>
  18. </template>
  19. <script >
  20. import { headerTitleBgs } from './data'
  21. import LinearText from "../LinearText";
  22. /**
  23. * 边框面板
  24. */
  25. export default {
  26. name: "BorderPanel",
  27. components: {
  28. LinearText
  29. },
  30. props: {
  31. title: {
  32. type: String,
  33. default: "标题"
  34. },
  35. width: {
  36. type: String,
  37. default: '443px'
  38. },
  39. height: {
  40. type: String,
  41. default: '200px'
  42. },
  43. headerType: {
  44. type: Number,
  45. default: 0
  46. }
  47. },
  48. computed: {
  49. borderPanelStyle: function () {
  50. return {
  51. "--height": this.$props.height,
  52. "--width": this.$props.width,
  53. '--header-ops': ['-4px', '0px'][this.$props.headerType]
  54. }
  55. },
  56. headerImageBgUrl: function() {
  57. return headerTitleBgs[this.$props.headerType]
  58. }
  59. }
  60. }
  61. </script>
  62. <style scoped>
  63. .border-panel {
  64. position: relative;
  65. height: var(--height);
  66. width: var(--width);
  67. box-sizing: border-box;
  68. /* background: linear-gradient(360deg, #0c5a87 0%, rgba(0, 163, 255, 0) 100%); */
  69. background: linear-gradient(360deg, rgba(0, 133, 255, 0.25) 0%, rgba(0, 163, 255, 0) 100%);
  70. }
  71. .border-panel_header{
  72. height: 50px;
  73. width: var(--width);
  74. background-image: url('../assets/border-panel_header_1.svg');
  75. background-repeat: no-repeat;
  76. background-position: var(--header-ops) 0px;
  77. }
  78. .border-panel::after {
  79. content: "";
  80. position: absolute;
  81. top: 0px;
  82. left: 0px;
  83. padding: 1px;
  84. box-sizing: border-box;
  85. width: var(--width);
  86. height: var(--height);
  87. background: linear-gradient(360deg, #0c5a87 0%, rgba(0, 163, 255, 0) 100%);
  88. /* 随便定义颜色 */
  89. --mask-bg: linear-gradient(red, red);
  90. --m-o: content-box, padding-box;
  91. /* mask允许使用者通过遮罩或者裁切特定区域的图片的方式来隐藏一个元素的部分或者全部可见区域 */
  92. /* 设置了用作元素蒙版层的图像,默认值为none,值为透明图片,或透明渐变 */
  93. -webkit-mask-image: var(--mask-bg), var(--mask-bg);
  94. /* 默认值为border-box,可选值与background-origin相同 */
  95. -webkit-mask-origin: var(--m-o);
  96. /* 默认值为border-box,可选值与background-clip相同 */
  97. -webkit-mask-clip: var(--m-o);
  98. /* exclude排除,只显示不重合的地方,Firefox支持4个属性 */
  99. mask-composite: exclude;
  100. /*只显示下方遮罩,重合的地方不显示*/
  101. -webkit-mask-composite: destination-out;
  102. }
  103. .border-panel_content {
  104. padding: 0px 1px 0px 1px;
  105. }
  106. </style>