支持SSR、升级Vue版本和增加新的icon (#40)
* search component add new style * update vue version and support ssr * unit test * add new icon * new icon
This commit is contained in:
@@ -67,6 +67,7 @@ export default {
|
||||
* 显示popup
|
||||
*/
|
||||
open() {
|
||||
if (this.$isServer) return;
|
||||
if (this.opened) return;
|
||||
|
||||
this.opening = true;
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import merge from 'src/utils/merge';
|
||||
import Vue from 'vue';
|
||||
|
||||
let context;
|
||||
if (window && window.popupContext) {
|
||||
context = window.popupContext;
|
||||
const _global = Vue.prototype.$isServer ? global : window;
|
||||
|
||||
if (_global && _global.popupContext) {
|
||||
context = _global.popupContext;
|
||||
}
|
||||
|
||||
const DEFAULT_CONTEXT = {
|
||||
@@ -13,7 +16,7 @@ const DEFAULT_CONTEXT = {
|
||||
modalStack: []
|
||||
};
|
||||
|
||||
context = window.popupContext = merge({}, DEFAULT_CONTEXT, context);
|
||||
context = _global.popupContext = merge({}, DEFAULT_CONTEXT, context);
|
||||
|
||||
const PopupContext = {
|
||||
getContext(key) {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import Vue from 'vue';
|
||||
import { addClass } from 'src/utils/dom';
|
||||
import PopupContext from './popup-context';
|
||||
|
||||
const getModal = function() {
|
||||
if (Vue.prototype.$isServer) return;
|
||||
let modalDom = PopupContext.getContext('modalDom');
|
||||
|
||||
if (modalDom) {
|
||||
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
export default {
|
||||
debounce(func, wait, immediate) {
|
||||
var timeout, args, context, timestamp, result;
|
||||
@@ -76,5 +78,5 @@ export default {
|
||||
return element.getBoundingClientRect().height;
|
||||
},
|
||||
|
||||
getComputedStyle: document.defaultView.getComputedStyle.bind(document.defaultView)
|
||||
getComputedStyle: !Vue.prototype.$isServer && document.defaultView.getComputedStyle.bind(document.defaultView)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user