support Nuxt.js

This commit is contained in:
梁灏 2017-07-10 15:36:09 +08:00
parent 825ed58099
commit a68c11a565
4 changed files with 16 additions and 4 deletions

View file

@ -1,3 +1,5 @@
import Vue from 'vue';
const isServer = Vue.prototype.$isServer;
// 判断参数是否是其中之一
export function oneOf (value, validList) {
for (let i = 0; i < validList.length; i++) {
@ -52,7 +54,7 @@ export function getScrollBarSize (fresh) {
}
// watch DOM change
export const MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver || false;
export const MutationObserver = isServer ? false : window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver || false;
const SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
const MOZ_HACK_REGEXP = /^moz([A-Z])/;

View file

@ -1,5 +1,4 @@
import Vue from 'vue';
const isServer = Vue.prototype.$isServer;
/* istanbul ignore next */