@mptw/skylens-ui 1.5.19 → 1.5.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/app.vue +2 -1
- package/app/components/SLCollapsableBlock.vue +19 -4
- package/package.json +1 -1
package/app/app.vue
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
.inline-flex.items-center.space-x-2
|
|
10
10
|
SLIcon(v-if='blockTitleIcon', :icon='blockTitleIcon' class='collapsable-block-title-icon')
|
|
11
11
|
.collapsable-block-title {{ blockTitle }}
|
|
12
|
+
slot(v-if='$slots.notice', name='notice')
|
|
12
13
|
.toggle-collapse-button
|
|
13
14
|
.button-title(v-if='isShowCollapseButtonTitle') {{ isCollapsed ? '展開' : '收合' }}
|
|
14
15
|
SLIcon(icon="chevron-down")
|
|
@@ -46,6 +47,8 @@ export default defineComponent({
|
|
|
46
47
|
const isCollapsed = ref(defaultCollapsed.value);
|
|
47
48
|
const bodyHeight = ref(0);
|
|
48
49
|
|
|
50
|
+
let observer: MutationObserver | null = null;
|
|
51
|
+
|
|
49
52
|
function onToggleCollapse() {
|
|
50
53
|
isCollapsed.value = !isCollapsed.value;
|
|
51
54
|
}
|
|
@@ -83,6 +86,21 @@ export default defineComponent({
|
|
|
83
86
|
onMounted(() => {
|
|
84
87
|
getWrapperHeight();
|
|
85
88
|
checkImageLoaded();
|
|
89
|
+
|
|
90
|
+
if (wrapperEl.value) {
|
|
91
|
+
observer = new MutationObserver(getWrapperHeight);
|
|
92
|
+
observer.observe(wrapperEl.value, {
|
|
93
|
+
childList: true,
|
|
94
|
+
attributes: true,
|
|
95
|
+
subtree: true,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
onBeforeUnmount(() => {
|
|
101
|
+
if (observer) {
|
|
102
|
+
observer.disconnect();
|
|
103
|
+
}
|
|
86
104
|
});
|
|
87
105
|
|
|
88
106
|
return {
|
|
@@ -101,10 +119,7 @@ export default defineComponent({
|
|
|
101
119
|
.sl-collapsable-block {
|
|
102
120
|
@apply p-3.75 border border-secondary-400 rounded-lg;
|
|
103
121
|
|
|
104
|
-
&.collapsed
|
|
105
|
-
.sl-collapsable-block-header
|
|
106
|
-
.toggle-collapse-button
|
|
107
|
-
.icon {
|
|
122
|
+
&.collapsed .sl-collapsable-block-header .toggle-collapse-button .icon {
|
|
108
123
|
@apply rotate-0;
|
|
109
124
|
}
|
|
110
125
|
|