diff --git a/src/index-bar/index.js b/src/index-bar/index.js index df7c3133b..4b6ef10f8 100644 --- a/src/index-bar/index.js +++ b/src/index-bar/index.js @@ -17,7 +17,7 @@ export default createComponent({ mixins: [ TouchMixin, ParentMixin('vanIndexBar'), - BindEventMixin(function (bind) { + BindEventMixin(function(bind) { if (!this.scroller) { this.scroller = getScrollEventTarget(this.$el); } diff --git a/src/list/index.js b/src/list/index.js index 24cad0d96..f7f22a132 100644 --- a/src/list/index.js +++ b/src/list/index.js @@ -8,7 +8,7 @@ const [createComponent, bem, t] = createNamespace('list'); export default createComponent({ mixins: [ - BindEventMixin(function (bind) { + BindEventMixin(function(bind) { if (!this.scroller) { this.scroller = getScrollEventTarget(this.$el); } @@ -44,68 +44,65 @@ export default createComponent({ mounted() { if (this.immediateCheck) { - this.$nextTick(this.check); + this.check(); } }, watch: { - loading() { - this.$nextTick(this.check); - }, - - finished() { - this.$nextTick(this.check); - } + loading: 'check', + finished: 'check' }, methods: { check() { - if (this.loading || this.finished || this.error) { - return; - } + this.$nextTick(() => { + if (this.loading || this.finished || this.error) { + return; + } - const { $el: el, scroller, offset, direction } = this; - let scrollerRect; + const { $el: el, scroller, offset, direction } = this; + let scrollerRect; - if (scroller.getBoundingClientRect) { - scrollerRect = scroller.getBoundingClientRect(); - } else { - scrollerRect = { - top: 0, - bottom: scroller.innerHeight - }; - } + if (scroller.getBoundingClientRect) { + scrollerRect = scroller.getBoundingClientRect(); + } else { + scrollerRect = { + top: 0, + bottom: scroller.innerHeight + }; + } - const scrollerHeight = scrollerRect.bottom - scrollerRect.top; + const scrollerHeight = scrollerRect.bottom - scrollerRect.top; - /* istanbul ignore next */ - if (!scrollerHeight || isHidden(el)) { - return false; - } + /* istanbul ignore next */ + if (!scrollerHeight || isHidden(el)) { + return false; + } - let isReachEdge = false; - const placeholderRect = this.$refs.placeholder.getBoundingClientRect(); + let isReachEdge = false; + const placeholderRect = this.$refs.placeholder.getBoundingClientRect(); - if (direction === 'up') { - isReachEdge = placeholderRect.top - scrollerRect.top <= offset; - } else { - isReachEdge = placeholderRect.bottom - scrollerRect.bottom <= offset; - } + if (direction === 'up') { + isReachEdge = placeholderRect.top - scrollerRect.top <= offset; + } else { + isReachEdge = placeholderRect.bottom - scrollerRect.bottom <= offset; + } - if (isReachEdge) { - this.$emit('input', true); - this.$emit('load'); - } + if (isReachEdge) { + this.$emit('input', true); + this.$emit('load'); + } + }); }, clickErrorText() { this.$emit('update:error', false); - this.$nextTick(this.check); + this.check(); } }, render() { - const Placeholder =
; + const Placeholder =
; return (
diff --git a/src/mixins/close-on-popstate.ts b/src/mixins/close-on-popstate.ts index 0a63d6246..4b5340869 100644 --- a/src/mixins/close-on-popstate.ts +++ b/src/mixins/close-on-popstate.ts @@ -4,7 +4,7 @@ import { BindEventMixin } from './bind-event'; export const CloseOnPopstateMixin = Vue.extend({ mixins: [ - BindEventMixin(function (this: any, bind, isBind) { + BindEventMixin(function(this: any, bind, isBind) { this.handlePopstate(isBind && this.closeOnPopstate); }) ], diff --git a/src/number-keyboard/index.js b/src/number-keyboard/index.js index 6687e2b11..bb7bc3403 100644 --- a/src/number-keyboard/index.js +++ b/src/number-keyboard/index.js @@ -9,7 +9,7 @@ const DELETE_KEY_THEME = ['delete', 'big', 'gray']; export default createComponent({ mixins: [ - BindEventMixin(function (bind) { + BindEventMixin(function(bind) { if (this.hideOnClickOutside) { bind(document.body, 'touchstart', this.onBlur); } diff --git a/src/sticky/index.js b/src/sticky/index.js index b42aac779..47eefbca2 100644 --- a/src/sticky/index.js +++ b/src/sticky/index.js @@ -6,7 +6,7 @@ const [createComponent, bem] = createNamespace('sticky'); export default createComponent({ mixins: [ - BindEventMixin(function (bind) { + BindEventMixin(function(bind) { if (!this.scroller) { this.scroller = getScrollEventTarget(this.$el); } diff --git a/src/style/var.less b/src/style/var.less index 4f499c2e8..2a852984e 100644 --- a/src/style/var.less +++ b/src/style/var.less @@ -327,7 +327,7 @@ // List @list-icon-margin-right: 5px; @list-text-color: @gray-dark; -@list-text-font-size: @font-size-sm; +@list-text-font-size: @font-size-md; @list-text-line-height: 50px; // Loading diff --git a/src/swipe/index.js b/src/swipe/index.js index 762137504..556ccd4fe 100644 --- a/src/swipe/index.js +++ b/src/swipe/index.js @@ -10,7 +10,7 @@ const [createComponent, bem] = createNamespace('swipe'); export default createComponent({ mixins: [ TouchMixin, - BindEventMixin(function (bind, isBind) { + BindEventMixin(function(bind, isBind) { bind(window, 'resize', this.onResize, true); if (isBind) { diff --git a/src/tabs/index.js b/src/tabs/index.js index d743db973..6e52028da 100644 --- a/src/tabs/index.js +++ b/src/tabs/index.js @@ -13,7 +13,7 @@ const [createComponent, bem] = createNamespace('tabs'); export default createComponent({ mixins: [ ParentMixin('vanTabs'), - BindEventMixin(function (bind) { + BindEventMixin(function(bind) { bind(window, 'resize', this.setLine, true); }) ], @@ -148,7 +148,12 @@ export default createComponent({ this.$nextTick(() => { const { titles } = this.$refs; - if (!titles || !titles[this.currentIndex] || this.type !== 'line' || isHidden(this.$el)) { + if ( + !titles || + !titles[this.currentIndex] || + this.type !== 'line' || + isHidden(this.$el) + ) { return; } diff --git a/src/utils/create/bem.ts b/src/utils/create/bem.ts index cf4923451..70ff7e5f6 100644 --- a/src/utils/create/bem.ts +++ b/src/utils/create/bem.ts @@ -37,7 +37,7 @@ function prefix(name: string, mods: Mods): Mods { } export function createBEM(name: string) { - return function (el?: Mods, mods?: Mods): Mods { + return function(el?: Mods, mods?: Mods): Mods { if (el && typeof el !== 'string') { mods = el; el = ''; diff --git a/src/utils/create/i18n.ts b/src/utils/create/i18n.ts index d1fdbf387..9d43c2e63 100644 --- a/src/utils/create/i18n.ts +++ b/src/utils/create/i18n.ts @@ -5,7 +5,7 @@ import locale from '../../locale'; export function createI18N(name: string) { const prefix = camelize(name) + '.'; - return function (path: string, ...args: any[]): string { + return function(path: string, ...args: any[]): string { const message = get(locale.messages(), prefix + path) || get(locale.messages(), path); return typeof message === 'function' ? message(...args) : message; };