hookehuyr

完善分割线组件内容

1 <!-- 1 <!--
2 * @Date: 2022-08-29 14:31:20 2 * @Date: 2022-08-29 14:31:20
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-11-22 14:23:49 4 + * @LastEditTime: 2024-08-29 14:52:43
5 * @FilePath: /data-table/src/components/DividerField/index.vue 5 * @FilePath: /data-table/src/components/DividerField/index.vue
6 * @Description: 分隔线组件 6 * @Description: 分隔线组件
7 --> 7 -->
8 <template> 8 <template>
9 <div class="divider-field-page"> 9 <div class="divider-field-page">
10 - <van-divider :style="styleObj"> 10 + <div class="sep-line">
11 - {{ item.component_props.content }} 11 + <div class="sep-label" :style="{ color: titleColor, backgroundColor: bgColor}">
12 - </van-divider> 12 + <span>字段标题</span>
13 + </div>
14 + <div class="sep-right">
15 + <div class="right-triangle" :style="{ backgroundColor: bgColor}"></div>
16 + <div class="right-line" :style="{ borderColor: bgColor }"></div>
17 + <div class="right-parallelogram1" :style="{ backgroundColor: bgColor}"></div>
18 + <div class="right-parallelogram2" :style="{ backgroundColor: bgColor}"></div>
19 + <div class="right-parallelogram3" :style="{ backgroundColor: bgColor}"></div>
20 + </div>
21 + </div>
22 + <div class="fx-sub-html">这里是字段的描述信息</div>
13 </div> 23 </div>
14 </template> 24 </template>
15 25
...@@ -18,17 +28,119 @@ const props = defineProps({ ...@@ -18,17 +28,119 @@ const props = defineProps({
18 item: Object, 28 item: Object,
19 }); 29 });
20 30
21 -const styleObj = ref({}); 31 +const styleTitle = ref({});
32 +const styleBorder = ref({});
33 +
34 +const bgColor = ref('');
35 +const titleColor = ref('');
36 +
22 onMounted(() => { 37 onMounted(() => {
23 - styleObj.value = { 38 + // styleObj.value = {
24 - color: props.item.component_props.color, 39 + // color: props.item.component_props.color,
25 - borderColor: props.item.component_props.color, 40 + // borderColor: props.item.component_props.color,
26 - padding: props.item.component_props.padding, 41 + // padding: props.item.component_props.padding,
42 + // };
43 + styleTitle.value = {
44 + color: "blue",
45 + fontSize: "0.9rem",
27 }; 46 };
47 + styleBorder.value = {
48 + border: "1px dashed",
49 + borderColor: "red",
50 + margin: "5px 0",
51 + };
52 +
53 + titleColor.value = 'rgb(250, 250, 24)';
54 + bgColor.value = 'rgb(240, 168, 0)';
28 }); 55 });
29 </script> 56 </script>
30 57
31 <style lang="less" scoped> 58 <style lang="less" scoped>
32 .divider-field-page { 59 .divider-field-page {
60 + padding: 1rem 1rem 0 1rem;
61 + .sep-line {
62 + display: -webkit-box;
63 + display: -ms-flexbox;
64 + display: flex;
65 + height: 28px;
66 + position: relative;
67 +
68 + .sep-label {
69 + -webkit-box-flex: 0;
70 + -webkit-box-sizing: content-box;
71 + box-sizing: content-box;
72 + -ms-flex: none;
73 + flex: none;
74 + height: 100%;
75 + line-height: 28px;
76 + max-width: 80%;
77 + min-width: 7%;
78 + overflow: hidden;
79 + padding: 0 10px;
80 + text-overflow: ellipsis;
81 + white-space: nowrap;
82 + }
83 +
84 + .sep-right {
85 + -webkit-box-flex: 1;
86 + -ms-flex: auto;
87 + flex: auto;
88 + position: relative;
89 + .right-triangle {
90 + height: 100%;
91 + -webkit-transform: skew(26deg) translateX(-50%);
92 + transform: skew(26deg) translateX(-50%);
93 + width: 15px;
94 + }
95 + }
96 +
97 + .right-line {
98 + border-bottom: 3px solid;
99 + bottom: 0;
100 + height: 0;
101 + left: 0;
102 + position: absolute;
103 + right: 0;
104 + }
105 +
106 + .right-parallelogram1 {
107 + height: 22px;
108 + left: 15px;
109 + opacity: 0.9;
110 + position: absolute;
111 + top: 0;
112 + -webkit-transform: skew(26deg) translateX(-50%);
113 + transform: skew(26deg) translateX(-50%);
114 + width: 8px;
115 + }
116 + .right-parallelogram2 {
117 + height: 22px;
118 + left: 27px;
119 + opacity: 0.6;
120 + position: absolute;
121 + top: 0;
122 + -webkit-transform: skew(26deg) translateX(-50%);
123 + transform: skew(26deg) translateX(-50%);
124 + width: 8px;
125 + }
126 + .right-parallelogram3 {
127 + height: 22px;
128 + left: 39px;
129 + opacity: 0.3;
130 + position: absolute;
131 + top: 0;
132 + -webkit-transform: skew(26deg) translateX(-50%);
133 + transform: skew(26deg) translateX(-50%);
134 + width: 8px;
135 + }
136 + }
137 + .fx-sub-html {
138 + color: #000;
139 + font-size: 0.85rem;
140 + line-height: 1.4;
141 + margin-top: 2px;
142 + word-wrap: break-word;
143 + line-height: 1.4;
144 + }
33 } 145 }
34 </style> 146 </style>
......