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

* fix ssr

* refine
pull/16759/head
luckyCao 2019-07-26 15:16:36 +08:00 committed by iamkun
parent f7a970c0ba
commit 2364c022ab
2 changed files with 6 additions and 3 deletions

View File

@ -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 = {
} }
}; };
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',

View File

@ -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'];