Commit 2364c022 authored by luckyCao's avatar luckyCao Committed by iamkun

Image: Fix image ssr (#16737) (#16747)

* fix ssr

* refine
parent f7a970c0
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<script> <script>
import { on, off } from 'element-ui/src/utils/dom'; 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 = { const Mode = {
CONTAIN: { CONTAIN: {
...@@ -66,8 +66,7 @@ const Mode = { ...@@ -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 { export default {
name: 'elImageViewer', name: 'elImageViewer',
......
...@@ -122,6 +122,10 @@ export const isEdge = function() { ...@@ -122,6 +122,10 @@ export const isEdge = function() {
return !Vue.prototype.$isServer && navigator.userAgent.indexOf('Edge') > -1; 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) { export const autoprefixer = function(style) {
if (typeof style !== 'object') return style; if (typeof style !== 'object') return style;
const rules = ['transform', 'transition', 'animation']; const rules = ['transform', 'transition', 'animation'];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment