[improvement] List: unify text font-size (#4077)

This commit is contained in:
neverland 2019-08-09 14:03:19 +08:00 committed by GitHub
parent 19cd2ed38e
commit 4cba618792
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 52 additions and 50 deletions

View File

@ -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);
}

View File

@ -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 = <div ref="placeholder" class={bem('placeholder')}/>;
const Placeholder = <div ref="placeholder" class={bem('placeholder')} />;
return (
<div class={bem()} role="feed" aria-busy={this.loading}>

View File

@ -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);
})
],

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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

View File

@ -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) {

View File

@ -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;
}

View File

@ -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 = '';

View File

@ -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;
};