Merge remote-tracking branch 'origin/master' into hotfix/waterfall

This commit is contained in:
pangxie1991
2017-02-27 10:35:19 +08:00
91 changed files with 939 additions and 268 deletions
+10 -3
View File
@@ -10,8 +10,9 @@ import Dialog from '../packages/dialog/index.js';
import Picker from '../packages/picker/index.js';
import RadioGroup from '../packages/radio-group/index.js';
import Waterfall from '../packages/waterfall/index.js';
// zanui
import '../packages/zanui-css/src/index.pcss';
import Loading from '../packages/loading/index.js';
import Panel from '../packages/panel/index.js';
import Card from '../packages/card/index.js';
const install = function(Vue) {
if (install.installed) return;
@@ -26,6 +27,9 @@ const install = function(Vue) {
Vue.component(Popup.name, Popup);
Vue.component(Picker.name, Picker);
Vue.component(RadioGroup.name, RadioGroup);
Vue.component(Loading.name, Loading);
Vue.component(Panel.name, Panel);
Vue.component(Card.name, Card);
};
// auto install
@@ -47,5 +51,8 @@ module.exports = {
Dialog,
Picker,
RadioGroup,
Waterfall
Waterfall,
Loading,
Panel,
Card
};
+2 -39
View File
@@ -12,30 +12,6 @@ const getDOM = function(dom) {
return dom;
};
let scrollBarWidth;
const getScrollBarWidth = () => {
if (scrollBarWidth !== undefined) return scrollBarWidth;
const outer = document.createElement('div');
outer.style.visibility = 'hidden';
outer.style.width = '100px';
outer.style.position = 'absolute';
outer.style.top = '-9999px';
document.body.appendChild(outer);
const widthNoScroll = outer.offsetWidth;
outer.style.overflow = 'scroll';
const inner = document.createElement('div');
inner.style.width = '100%';
outer.appendChild(inner);
const widthWithScroll = inner.offsetWidth;
outer.parentNode.removeChild(outer);
return widthNoScroll - widthWithScroll;
};
export default {
props: {
/**
@@ -92,8 +68,7 @@ export default {
opening: false,
opened: false,
closing: false,
bodyOverflow: null,
bodyPaddingRight: null
bodyOverflow: null
};
},
@@ -128,19 +103,11 @@ export default {
// 如果滚动时需要锁定
if (props.lockOnScroll) {
// 将原来的`bodyOverflow`和`bodyPaddingRight`存起来
// 将原来的`bodyOverflow`存起来
if (!this.bodyOverflow) {
this.bodyPaddingRight = document.body.style.paddingRight;
this.bodyOverflow = document.body.style.overflow;
}
scrollBarWidth = getScrollBarWidth();
// 页面是否`overflow`
let bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
if (scrollBarWidth > 0 && bodyHasOverflow) {
document.body.style.paddingRight = scrollBarWidth + 'px';
}
document.body.style.overlay = 'hidden';
}
}
@@ -164,10 +131,8 @@ export default {
setTimeout(() => {
if (this.modal && this.bodyOverflow !== 'hidden') {
document.body.style.overflow = this.bodyOverflow;
document.body.style.paddingRight = this.bodyPaddingRight;
}
this.bodyOverflow = null;
this.bodyPaddingRight = null;
}, 200);
}
@@ -187,9 +152,7 @@ export default {
if (this.modal && this.bodyOverflow !== null && this.bodyOverflow !== 'hidden') {
document.body.style.overflow = this.bodyOverflow;
document.body.style.paddingRight = this.bodyPaddingRight;
}
this.bodyOverflow = null;
this.bodyPaddingRight = null;
}
};
+3 -7
View File
@@ -70,7 +70,7 @@ const PopupManager = {
const modalStack = this.modalStack;
for (let i = 0, j = modalStack.length; i < j; i++) {
for (let i = 0, len = modalStack.length; i < len; i++) {
const item = modalStack[i];
if (item.id === id) {
return;
@@ -79,10 +79,7 @@ const PopupManager = {
const modalDom = getModal();
addClass(modalDom, 'v-modal');
setTimeout(() => {
removeClass(modalDom, 'v-modal-enter');
}, 200);
addClass(modalDom, 'z-modal');
if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
dom.parentNode.appendChild(modalDom);
@@ -125,9 +122,8 @@ const PopupManager = {
if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom);
modalDom.style.display = 'none';
this.modalDom = undefined;
this.modalDom = null;
}
removeClass(modalDom, 'v-modal-leave');
}, 200);
}
}
+2 -2
View File
@@ -7,7 +7,7 @@ if (!Vue.prototype.$isServer) {
var engine;
var translate3d = false;
if (window.opera && Object.prototype.toString.call(opera) === '[object Opera]') {
if (window.opera && Object.prototype.toString.call(window.opera) === '[object Opera]') {
engine = 'presto';
} else if ('MozAppearance' in docStyle) {
engine = 'gecko';
@@ -77,7 +77,7 @@ if (!Vue.prototype.$isServer) {
if (element === null || element.style === null) return;
var transformValue = element.style[transformProperty];
if (transformValue) {
transformValue = transformValue.replace(/translate\(\s*(-?\d+(\.?\d+?)?)px,\s*(-?\d+(\.\d+)?)px\)\s*translateZ\(0px\)/g, '');
element.style[transformProperty] = transformValue;