tabs组件支持滑动 (#52)

This commit is contained in:
张敏
2017-07-11 14:35:39 +08:00
committed by GitHub
parent aaaba3888f
commit 2cc8f2ae5e
15 changed files with 331 additions and 62 deletions
@@ -6,6 +6,7 @@ let instance;
const ImagePreviewConstructor = Vue.extend(ImagePreview);
const initInstance = () => {
/* istanbul ignore if */
if (Vue.prototype.$isServer) return;
instance = new ImagePreviewConstructor({
el: document.createElement('div')
@@ -13,6 +14,7 @@ const initInstance = () => {
};
var ImagePreviewBox = images => {
/* istanbul ignore if */
if (Vue.prototype.$isServer) return;
if (!instance) {
initInstance();
@@ -92,6 +92,7 @@ export default {
const supportTouch = !Vue.prototype.$isServer && 'ontouchstart' in window;
const container = this.$refs.previewContainer;
/* istanbul ignore else */
if (supportTouch) {
let touchStartTime;
@@ -99,6 +100,7 @@ export default {
touchStartTime = new Date();
});
container.addEventListener('touchend', () => {
/* istanbul ignore else */
if (new Date() - touchStartTime < 1500) {
this.value = false;
}