Skip to content

Commit b271338

Browse files
luckyCaoa631807682
authored andcommitted
Image: Fix image ssr (ElemeFE#16737) (ElemeFE#16747)
* fix ssr * refine
1 parent b25e374 commit b271338

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/image/src/image-viewer.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454
<script>
5555
import { on, off } from 'element-ui/src/utils/dom';
56-
import { rafThrottle } from 'element-ui/src/utils/util';
56+
import { rafThrottle, isFirefox } from 'element-ui/src/utils/util';
5757
5858
const Mode = {
5959
CONTAIN: {
@@ -66,8 +66,7 @@ const Mode = {
6666
}
6767
};
6868
69-
const isFirefox = !!window.navigator.userAgent.match(/firefox/i);
70-
const mousewheelEventName = isFirefox ? 'DOMMouseScroll' : 'mousewheel';
69+
const mousewheelEventName = isFirefox() ? 'DOMMouseScroll' : 'mousewheel';
7170
7271
export default {
7372
name: 'elImageViewer',

src/utils/util.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ export const isEdge = function() {
122122
return !Vue.prototype.$isServer && navigator.userAgent.indexOf('Edge') > -1;
123123
};
124124

125+
export const isFirefox = function() {
126+
return !Vue.prototype.$isServer && !!window.navigator.userAgent.match(/firefox/i);
127+
};
128+
125129
export const autoprefixer = function(style) {
126130
if (typeof style !== 'object') return style;
127131
const rules = ['transform', 'transition', 'animation'];

0 commit comments

Comments
 (0)