Skip to content

Commit

Permalink
Image: Fix image ssr (ElemeFE#16737) (ElemeFE#16747)
Browse files Browse the repository at this point in the history
* fix ssr

* refine
  • Loading branch information
luckyCao authored and a631807682 committed Aug 1, 2019
1 parent b25e374 commit b271338
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/image/src/image-viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

<script>
import { on, off } from 'element-ui/src/utils/dom';
import { rafThrottle } from 'element-ui/src/utils/util';
import { rafThrottle, isFirefox } from 'element-ui/src/utils/util';
const Mode = {
CONTAIN: {
Expand All @@ -66,8 +66,7 @@ const Mode = {
}
};
const isFirefox = !!window.navigator.userAgent.match(/firefox/i);
const mousewheelEventName = isFirefox ? 'DOMMouseScroll' : 'mousewheel';
const mousewheelEventName = isFirefox() ? 'DOMMouseScroll' : 'mousewheel';
export default {
name: 'elImageViewer',
Expand Down
4 changes: 4 additions & 0 deletions src/utils/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ export const isEdge = function() {
return !Vue.prototype.$isServer && navigator.userAgent.indexOf('Edge') > -1;
};

export const isFirefox = function() {
return !Vue.prototype.$isServer && !!window.navigator.userAgent.match(/firefox/i);
};

export const autoprefixer = function(style) {
if (typeof style !== 'object') return style;
const rules = ['transform', 'transition', 'animation'];
Expand Down

0 comments on commit b271338

Please sign in to comment.