mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[improvement] List: unify text font-size (#4077)
This commit is contained in:
parent
19cd2ed38e
commit
4cba618792
@ -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);
|
||||
}
|
||||
|
@ -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}>
|
||||
|
@ -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);
|
||||
})
|
||||
],
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 = '';
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user