tabs组件支持滑动 (#52)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user