diff --git a/src/calendar/components/Month.js b/src/calendar/components/Month.js index 2703fbec1..50280034f 100644 --- a/src/calendar/components/Month.js +++ b/src/calendar/components/Month.js @@ -90,11 +90,14 @@ export default createComponent({ }, }, - mounted() { - this.height = this.$el.getBoundingClientRect().height; - }, - methods: { + getHeight() { + if (!this.height) { + this.height = this.$el.getBoundingClientRect().height; + } + return this.height; + }, + scrollIntoView() { if (this.showSubtitle) { this.$refs.days.scrollIntoView(); diff --git a/src/calendar/index.js b/src/calendar/index.js index 1fa30530e..e05b3a13a 100644 --- a/src/calendar/index.js +++ b/src/calendar/index.js @@ -234,7 +234,7 @@ export default createComponent({ const { body, months } = this.$refs; const top = getScrollTop(body); const bottom = top + this.bodyHeight; - const heights = months.map((item) => item.height); + const heights = months.map((item) => item.getHeight()); const heightSum = heights.reduce((a, b) => a + b, 0); // iOS scroll bounce may exceed the range diff --git a/src/image/index.js b/src/image/index.js index 4f426b951..0b16ebb83 100644 --- a/src/image/index.js +++ b/src/image/index.js @@ -1,4 +1,4 @@ -import { createNamespace, isDef, addUnit } from '../utils'; +import { createNamespace, isDef, addUnit, inBrowser } from '../utils'; import Icon from '../icon'; const [createComponent, bem] = createNamespace('image'); @@ -69,7 +69,7 @@ export default createComponent({ created() { const { $Lazyload } = this; - if ($Lazyload) { + if ($Lazyload && inBrowser) { $Lazyload.$on('loaded', this.onLazyLoaded); $Lazyload.$on('error', this.onLazyLoadError); } diff --git a/src/picker/PickerColumn.js b/src/picker/PickerColumn.js index e6a91317e..758558389 100644 --- a/src/picker/PickerColumn.js +++ b/src/picker/PickerColumn.js @@ -168,6 +168,7 @@ export default createComponent({ return; } + this.transitionEndTrigger = null; this.duration = DEFAULT_DURATION; this.setIndex(index, true); }, diff --git a/src/utils/index.ts b/src/utils/index.ts index feffd5dbf..83f5ff38b 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,9 +1,10 @@ -// import Vue from 'vue'; +import Vue from 'vue'; -// export { createNamespace } from './create'; +export { createNamespace } from './create'; export { addUnit } from './format/unit'; -// export const isServer: boolean = Vue.prototype.$isServer; +export const inBrowser = typeof window !== 'undefined'; +export const isServer: boolean = Vue.prototype.$isServer; // eslint-disable-next-line @typescript-eslint/no-empty-function export function noop() {}