From ce21f67478e3f0e73c832690c1068e0e55a5c031 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 22 Aug 2020 09:24:13 +0900 Subject: [PATCH] wip --- src/client/default.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/client/default.vue b/src/client/default.vue index edf88e8eb1..42e134d6b9 100644 --- a/src/client/default.vue +++ b/src/client/default.vue @@ -267,7 +267,10 @@ export default defineComponent({ if (!this.isDesktop) return; if (this.$store.state.device.fixedWidgetsPosition) return; - const stickyWidgetColumns = this.$refs.widgets.map(w => new StickySidebar(w.children[1], w.children[0], w.offsetTop)); + // NOTE: Vue3の仕様かどうか知らんけど this.$refs.widgets が要素が一つしかない場合に配列ではないので配列にする + const widgets = Array.isArray(this.$refs.widgets) ? this.$refs.widgets : [this.$refs.widgets]; + + const stickyWidgetColumns = widgets.map(w => new StickySidebar(w.children[1], w.children[0], w.offsetTop)); window.addEventListener('scroll', () => { for (const stickyWidgetColumn of stickyWidgetColumns) { stickyWidgetColumn.calc(window.scrollY);