Skip to content

Commit

Permalink
fix(Sticky): broke ssr (youzan#5958)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan committed Mar 31, 2020
1 parent 4dc3c79 commit 336295e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sticky/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isHidden } from '../utils/dom/style';
import { createNamespace, isDef } from '../utils';
import { createNamespace, isDef, isServer } from '../utils';
import { getScrollTop, getElementTop, getScroller } from '../utils/dom/scroll';
import { BindEventMixin } from '../mixins/bind-event';

Expand Down Expand Up @@ -65,7 +65,7 @@ export default createComponent({

created() {
// compatibility: https://caniuse.com/#feat=intersectionobserver
if (window.IntersectionObserver) {
if (!isServer && window.IntersectionObserver) {
this.observer = new IntersectionObserver(
entries => {
// trigger scroll when visibility changed
Expand Down

0 comments on commit 336295e

Please sign in to comment.