diff --git a/docs/site/mobile.js b/docs/site/mobile.js
index ad0bb8c58..166e36204 100644
--- a/docs/site/mobile.js
+++ b/docs/site/mobile.js
@@ -6,11 +6,11 @@ import { camelize } from '../../src/utils/format/string';
import enUS from '../../src/locale/lang/en-US';
Vue.use(Lazyload, {
- lazyComponent: true
+ lazyComponent: true,
});
Locale.add({
- 'en-US': enUS
+ 'en-US': enUS,
});
// flag for vant-weapp demos
@@ -33,7 +33,7 @@ Vue.mixin({
isWeapp() {
return isWeapp;
- }
+ },
},
beforeCreate() {
@@ -49,7 +49,7 @@ Vue.mixin({
Locale.add(locales);
}
- }
+ },
});
// switch lang after routing
@@ -91,7 +91,7 @@ Locale.add({
advancedUsage: '高级用法',
loadingStatus: '加载状态',
usernamePlaceholder: '请输入用户名',
- passwordPlaceholder: '请输入密码'
+ passwordPlaceholder: '请输入密码',
},
'en-US': {
add: 'Add',
@@ -119,6 +119,6 @@ Locale.add({
basicUsage: 'Basic Usage',
advancedUsage: 'Advanced Usage',
usernamePlaceholder: 'Username',
- passwordPlaceholder: 'Password'
- }
+ passwordPlaceholder: 'Password',
+ },
});
diff --git a/packages/vant-icons/build/build-iconfont.js b/packages/vant-icons/build/build-iconfont.js
index 04d5dad9a..a85368ccd 100644
--- a/packages/vant-icons/build/build-iconfont.js
+++ b/packages/vant-icons/build/build-iconfont.js
@@ -36,13 +36,13 @@ function font() {
targetPath: '../src/index.less',
normalize: true,
firstGlyph: 0xf000,
- cssClass: fontName // this is a trick to pass fontName to template
+ cssClass: fontName, // this is a trick to pass fontName to template
})
)
.pipe(
iconfont({
fontName,
- formats
+ formats,
})
)
.pipe(dest(srcDir));
diff --git a/packages/vant-icons/build/export.js b/packages/vant-icons/build/export.js
index 85e90a3b8..b73633780 100644
--- a/packages/vant-icons/build/export.js
+++ b/packages/vant-icons/build/export.js
@@ -4,7 +4,8 @@ const shell = require('shelljs');
const svgDir = path.join(__dirname, '../assets/svg');
const sketch = path.join(__dirname, '../assets/icons.sketch');
-const SKETCH_TOOL_DIR = '/Applications/Sketch.app/Contents/Resources/sketchtool/bin/sketchtool';
+const SKETCH_TOOL_DIR =
+ '/Applications/Sketch.app/Contents/Resources/sketchtool/bin/sketchtool';
fs.removeSync(svgDir);
diff --git a/packages/vant-icons/src/config.js b/packages/vant-icons/src/config.js
index 300f58444..a8dea9263 100644
--- a/packages/vant-icons/src/config.js
+++ b/packages/vant-icons/src/config.js
@@ -8,7 +8,7 @@ module.exports = {
'arrow',
'arrow-left',
'arrow-up',
- 'arrow-down'
+ 'arrow-down',
],
outline: [
// has corresponding filled icon
@@ -142,7 +142,7 @@ module.exports = {
'discount',
'idcard',
'replay',
- 'shrink'
+ 'shrink',
],
filled: [
// has corresponding outline icon
@@ -235,6 +235,6 @@ module.exports = {
'ascending',
'descending',
'bars',
- 'wap-nav'
- ]
+ 'wap-nav',
+ ],
};
diff --git a/packages/vant-markdown-loader/src/card-wrapper.js b/packages/vant-markdown-loader/src/card-wrapper.js
index f1434f80e..6216cdef9 100644
--- a/packages/vant-markdown-loader/src/card-wrapper.js
+++ b/packages/vant-markdown-loader/src/card-wrapper.js
@@ -1,5 +1,8 @@
module.exports = function cardWrapper(html) {
- const group = html.replace(/
{
diff --git a/packages/vant-markdown-loader/src/index.js b/packages/vant-markdown-loader/src/index.js
index d0090f558..d04430519 100644
--- a/packages/vant-markdown-loader/src/index.js
+++ b/packages/vant-markdown-loader/src/index.js
@@ -47,10 +47,10 @@ export default {
const parser = new MarkdownIt({
html: true,
- highlight
+ highlight,
}).use(markdownItAnchor, {
level: 2,
- slugify
+ slugify,
});
module.exports = function(source) {
@@ -60,7 +60,7 @@ module.exports = function(source) {
options = {
wrapper,
linkOpen: true,
- ...options
+ ...options,
};
let fm;
diff --git a/packages/vant-markdown-vetur/src/codegen.ts b/packages/vant-markdown-vetur/src/codegen.ts
index 2ec022e3b..0e09d671a 100644
--- a/packages/vant-markdown-vetur/src/codegen.ts
+++ b/packages/vant-markdown-vetur/src/codegen.ts
@@ -65,7 +65,7 @@ export function codegen(artical: Artical) {
const key = camelCaseToKebabCase(match[1] || 'default');
const tag: Tag = tags[key] || {
description: tagDescription,
- attributes: {}
+ attributes: {},
};
tags[key] = tag;
@@ -77,7 +77,7 @@ export function codegen(artical: Artical) {
const attr: Attribute = {
description: getDescription(td, isProp),
- type: isProp ? td[2].replace(/`/g, '').toLowerCase() : 'event'
+ type: isProp ? td[2].replace(/`/g, '').toLowerCase() : 'event',
};
tag.attributes[name] = attr;
diff --git a/packages/vant-markdown-vetur/src/index.ts b/packages/vant-markdown-vetur/src/index.ts
index 8cec37615..7442fea85 100644
--- a/packages/vant-markdown-vetur/src/index.ts
+++ b/packages/vant-markdown-vetur/src/index.ts
@@ -8,7 +8,7 @@ import {
existsSync,
readdirSync,
readFileSync,
- writeFileSync
+ writeFileSync,
} from 'fs';
export function parseText(input: string) {
@@ -43,18 +43,18 @@ export type ParseResult = {
const defaultOptions = {
maxDeep: Infinity,
- tagPrefix: ''
+ tagPrefix: '',
};
export function parse(options: Options) {
options = {
...defaultOptions,
- ...options
+ ...options,
};
const result: ParseResult = {
tags: {},
- attributes: {}
+ attributes: {},
};
function putResult(componentName: string, component: Tag) {
@@ -62,7 +62,7 @@ export function parse(options: Options) {
const attributes = Object.keys(component.attributes);
const tag = {
description: component.description,
- attributes
+ attributes,
};
result.tags[componentName] = tag;
@@ -85,7 +85,7 @@ export function parse(options: Options) {
recursiveParse(
{
...options,
- path: currentPath
+ path: currentPath,
},
deep
);
@@ -123,7 +123,10 @@ export function parseAndWrite(options: Options) {
mkdirSync(options.outputDir);
}
- writeFileSync(join(options.outputDir, 'tags.json'), JSON.stringify(tags, null, 2));
+ writeFileSync(
+ join(options.outputDir, 'tags.json'),
+ JSON.stringify(tags, null, 2)
+ );
writeFileSync(
join(options.outputDir, 'attributes.json'),
JSON.stringify(attributes, null, 2)
@@ -133,5 +136,5 @@ export function parseAndWrite(options: Options) {
export default {
parse,
parseText,
- parseAndWrite
+ parseAndWrite,
};
diff --git a/packages/vant-markdown-vetur/src/md-parser.ts b/packages/vant-markdown-vetur/src/md-parser.ts
index dc23c79f0..673e1a560 100644
--- a/packages/vant-markdown-vetur/src/md-parser.ts
+++ b/packages/vant-markdown-vetur/src/md-parser.ts
@@ -43,7 +43,7 @@ function tableParse(input: string) {
const end = input.length;
const table: TableContent = {
head: [],
- body: []
+ body: [],
};
while (start < end) {
@@ -69,7 +69,7 @@ function tableParse(input: string) {
return {
table,
- usedLength: start
+ usedLength: start,
};
}
@@ -86,7 +86,7 @@ export function mdParser(input: string): Array {
artical.push({
type: 'title',
content: match[2],
- level: match[1].length
+ level: match[1].length,
});
start += match.index + match[0].length;
@@ -94,7 +94,7 @@ export function mdParser(input: string): Array {
const { table, usedLength } = tableParse(target.substr(match.index));
artical.push({
type: 'table',
- table
+ table,
});
start += match.index + usedLength;
diff --git a/packages/vant-stylelint-config/index.js b/packages/vant-stylelint-config/index.js
index d7955a711..0a8e205a8 100644
--- a/packages/vant-stylelint-config/index.js
+++ b/packages/vant-stylelint-config/index.js
@@ -6,6 +6,6 @@ module.exports = {
'number-leading-zero': null,
'no-descending-specificity': null,
'declaration-colon-newline-after': null,
- 'font-family-no-missing-generic-family-keyword': null
- }
+ 'font-family-no-missing-generic-family-keyword': null,
+ },
};
diff --git a/packages/vant-touch-emulator/index.js b/packages/vant-touch-emulator/index.js
index 92674603c..dfa3607b7 100644
--- a/packages/vant-touch-emulator/index.js
+++ b/packages/vant-touch-emulator/index.js
@@ -9,16 +9,30 @@ var supportTouch = 'ontouchstart' in window;
// polyfills
if (!document.createTouch) {
- document.createTouch = function(view, target, identifier, pageX, pageY, screenX, screenY) {
+ document.createTouch = function(
+ view,
+ target,
+ identifier,
+ pageX,
+ pageY,
+ screenX,
+ screenY
+ ) {
// auto set
- return new Touch(target, identifier, {
- pageX: pageX,
- pageY: pageY,
- screenX: screenX,
- screenY: screenY,
- clientX: pageX - window.pageXOffset,
- clientY: pageY - window.pageYOffset
- }, 0, 0);
+ return new Touch(
+ target,
+ identifier,
+ {
+ pageX: pageX,
+ pageY: pageY,
+ screenX: screenX,
+ screenY: screenY,
+ clientX: pageX - window.pageXOffset,
+ clientY: pageY - window.pageYOffset,
+ },
+ 0,
+ 0
+ );
};
}
@@ -78,15 +92,12 @@ function TouchList() {
return touchList;
}
-
-
/**
* only trigger touches when the left mousebutton has been pressed
* @param touchType
* @returns {Function}
*/
-
var initiated = false;
function onMouse(touchType) {
return function(ev) {
@@ -101,13 +112,17 @@ function onMouse(touchType) {
}
if (ev.type === 'mousemove' && !initiated) {
- return
+ return;
}
// The EventTarget on which the touch point started when it was first placed on the surface,
// even if the touch point has since moved outside the interactive area of that element.
// also, when the target doesnt exist anymore, we update it
- if (ev.type === 'mousedown' || !eventTarget || eventTarget && !eventTarget.dispatchEvent) {
+ if (
+ ev.type === 'mousedown' ||
+ !eventTarget ||
+ (eventTarget && !eventTarget.dispatchEvent)
+ ) {
eventTarget = ev.target;
}
diff --git a/packages/vant-waterfall/src/directive.js b/packages/vant-waterfall/src/directive.js
index 1666e66f2..2bd668d93 100644
--- a/packages/vant-waterfall/src/directive.js
+++ b/packages/vant-waterfall/src/directive.js
@@ -3,7 +3,7 @@ import {
getScrollTop,
getElementTop,
getVisibleHeight,
- getScrollEventTarget
+ getScrollEventTarget,
} from './scroll';
const CONTEXT = '@@Waterfall';
@@ -27,14 +27,18 @@ function handleScrollEvent() {
// 判断是否到了底
let needLoadMoreToLower = false;
if (element === scrollEventTarget) {
- needLoadMoreToLower = scrollEventTarget.scrollHeight - targetBottom < this.offset;
+ needLoadMoreToLower =
+ scrollEventTarget.scrollHeight - targetBottom < this.offset;
} else {
const elementBottom =
- getElementTop(element) - getElementTop(scrollEventTarget) + getVisibleHeight(element);
+ getElementTop(element) -
+ getElementTop(scrollEventTarget) +
+ getVisibleHeight(element);
needLoadMoreToLower = elementBottom - targetVisibleHeight < this.offset;
}
if (needLoadMoreToLower) {
- this.cb.lower && this.cb.lower({ target: scrollEventTarget, top: targetScrollTop });
+ this.cb.lower &&
+ this.cb.lower({ target: scrollEventTarget, top: targetScrollTop });
}
// 判断是否到了顶
@@ -42,11 +46,13 @@ function handleScrollEvent() {
if (element === scrollEventTarget) {
needLoadMoreToUpper = targetScrollTop < this.offset;
} else {
- const elementTop = getElementTop(element) - getElementTop(scrollEventTarget);
+ const elementTop =
+ getElementTop(element) - getElementTop(scrollEventTarget);
needLoadMoreToUpper = elementTop + this.offset > 0;
}
if (needLoadMoreToUpper) {
- this.cb.upper && this.cb.upper({ target: scrollEventTarget, top: targetScrollTop });
+ this.cb.upper &&
+ this.cb.upper({ target: scrollEventTarget, top: targetScrollTop });
}
}
@@ -103,14 +109,14 @@ function doCheckStartBind(el) {
}
}
-export default function (type) {
+export default function(type) {
return {
bind(el, binding, vnode) {
if (!el[CONTEXT]) {
el[CONTEXT] = {
el,
vm: vnode.context,
- cb: {}
+ cb: {},
};
}
el[CONTEXT].cb[type] = binding.value;
@@ -128,6 +134,6 @@ export default function (type) {
if (context.scrollEventTarget) {
off(context.scrollEventTarget, 'scroll', context.scrollEventListener);
}
- }
+ },
};
}
diff --git a/packages/vant-waterfall/src/event.js b/packages/vant-waterfall/src/event.js
index 0713d59ba..1d3b2ea62 100644
--- a/packages/vant-waterfall/src/event.js
+++ b/packages/vant-waterfall/src/event.js
@@ -8,10 +8,10 @@ try {
get() {
/* istanbul ignore next */
supportsPassive = true;
- }
+ },
});
window.addEventListener('test-passive', null, opts);
-// eslint-disable-next-line no-empty
+ // eslint-disable-next-line no-empty
} catch (e) {}
export function on(target, event, handler, passive = false) {
diff --git a/packages/vant-waterfall/src/index.js b/packages/vant-waterfall/src/index.js
index 612f87b27..7eaa335fc 100644
--- a/packages/vant-waterfall/src/index.js
+++ b/packages/vant-waterfall/src/index.js
@@ -1,6 +1,6 @@
import Waterfall from './directive';
-Waterfall.install = function (Vue) {
+Waterfall.install = function(Vue) {
Vue.directive('WaterfallLower', Waterfall('lower'));
Vue.directive('WaterfallUpper', Waterfall('upper'));
};
diff --git a/types/image-preview.d.ts b/types/image-preview.d.ts
index c282634f1..c3b653f0d 100644
--- a/types/image-preview.d.ts
+++ b/types/image-preview.d.ts
@@ -1,21 +1,23 @@
import { VanPopupMixin } from './mixins/popup';
-export type ImagePreviewOptions = string[] | {
- loop?: boolean;
- images: string[];
- maxZoom?: number;
- minZoom?: number;
- className?: any;
- lazyLoad?: boolean;
- showIndex?: boolean;
- asyncClose?: boolean;
- swipeDuration?: number;
- startPosition?: number;
- showIndicators?: boolean;
- closeOnPopstate?: boolean;
- onClose?: () => void;
- onChange?: (index: number) => void;
-};
+export type ImagePreviewOptions =
+ | string[]
+ | {
+ loop?: boolean;
+ images: string[];
+ maxZoom?: number;
+ minZoom?: number;
+ className?: any;
+ lazyLoad?: boolean;
+ showIndex?: boolean;
+ asyncClose?: boolean;
+ swipeDuration?: number;
+ startPosition?: number;
+ showIndicators?: boolean;
+ closeOnPopstate?: boolean;
+ onClose?: () => void;
+ onChange?: (index: number) => void;
+ };
export class VanImagePreview extends VanPopupMixin {
images: string[];
diff --git a/types/index.d.ts b/types/index.d.ts
index d9803647f..3f1971218 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -110,5 +110,5 @@ export {
SwipeCell,
Tabs,
Toast,
- Uploader
+ Uploader,
};
diff --git a/types/lazyload.d.ts b/types/lazyload.d.ts
index 11baba3e8..470fbbfdf 100644
--- a/types/lazyload.d.ts
+++ b/types/lazyload.d.ts
@@ -1,7 +1,7 @@
-import Vue, { PluginFunction } from 'vue';
+import { PluginFunction } from 'vue';
export interface Lazyload {
- install: PluginFunction
+ install: PluginFunction;
}
export const Lazyload: Lazyload;
diff --git a/types/toast.d.ts b/types/toast.d.ts
index 24c3761bb..b8f3f26c7 100644
--- a/types/toast.d.ts
+++ b/types/toast.d.ts
@@ -41,7 +41,10 @@ export interface Toast {
fail(options?: ToastOptions | ToastMessage): VanToast;
clear(all?: boolean): void;
install(): void;
- setDefaultOptions(type: ToastType | ToastOptions, options?: ToastOptions): void;
+ setDefaultOptions(
+ type: ToastType | ToastOptions,
+ options?: ToastOptions
+ ): void;
resetDefaultOptions(options?: string): void;
allowMultiple(allow: boolean): void;
}