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: [
|
mixins: [
|
||||||
TouchMixin,
|
TouchMixin,
|
||||||
ParentMixin('vanIndexBar'),
|
ParentMixin('vanIndexBar'),
|
||||||
BindEventMixin(function (bind) {
|
BindEventMixin(function(bind) {
|
||||||
if (!this.scroller) {
|
if (!this.scroller) {
|
||||||
this.scroller = getScrollEventTarget(this.$el);
|
this.scroller = getScrollEventTarget(this.$el);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ const [createComponent, bem, t] = createNamespace('list');
|
|||||||
|
|
||||||
export default createComponent({
|
export default createComponent({
|
||||||
mixins: [
|
mixins: [
|
||||||
BindEventMixin(function (bind) {
|
BindEventMixin(function(bind) {
|
||||||
if (!this.scroller) {
|
if (!this.scroller) {
|
||||||
this.scroller = getScrollEventTarget(this.$el);
|
this.scroller = getScrollEventTarget(this.$el);
|
||||||
}
|
}
|
||||||
@ -44,68 +44,65 @@ export default createComponent({
|
|||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.immediateCheck) {
|
if (this.immediateCheck) {
|
||||||
this.$nextTick(this.check);
|
this.check();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
loading() {
|
loading: 'check',
|
||||||
this.$nextTick(this.check);
|
finished: 'check'
|
||||||
},
|
|
||||||
|
|
||||||
finished() {
|
|
||||||
this.$nextTick(this.check);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
check() {
|
check() {
|
||||||
if (this.loading || this.finished || this.error) {
|
this.$nextTick(() => {
|
||||||
return;
|
if (this.loading || this.finished || this.error) {
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const { $el: el, scroller, offset, direction } = this;
|
const { $el: el, scroller, offset, direction } = this;
|
||||||
let scrollerRect;
|
let scrollerRect;
|
||||||
|
|
||||||
if (scroller.getBoundingClientRect) {
|
if (scroller.getBoundingClientRect) {
|
||||||
scrollerRect = scroller.getBoundingClientRect();
|
scrollerRect = scroller.getBoundingClientRect();
|
||||||
} else {
|
} else {
|
||||||
scrollerRect = {
|
scrollerRect = {
|
||||||
top: 0,
|
top: 0,
|
||||||
bottom: scroller.innerHeight
|
bottom: scroller.innerHeight
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const scrollerHeight = scrollerRect.bottom - scrollerRect.top;
|
const scrollerHeight = scrollerRect.bottom - scrollerRect.top;
|
||||||
|
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
if (!scrollerHeight || isHidden(el)) {
|
if (!scrollerHeight || isHidden(el)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let isReachEdge = false;
|
let isReachEdge = false;
|
||||||
const placeholderRect = this.$refs.placeholder.getBoundingClientRect();
|
const placeholderRect = this.$refs.placeholder.getBoundingClientRect();
|
||||||
|
|
||||||
if (direction === 'up') {
|
if (direction === 'up') {
|
||||||
isReachEdge = placeholderRect.top - scrollerRect.top <= offset;
|
isReachEdge = placeholderRect.top - scrollerRect.top <= offset;
|
||||||
} else {
|
} else {
|
||||||
isReachEdge = placeholderRect.bottom - scrollerRect.bottom <= offset;
|
isReachEdge = placeholderRect.bottom - scrollerRect.bottom <= offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isReachEdge) {
|
if (isReachEdge) {
|
||||||
this.$emit('input', true);
|
this.$emit('input', true);
|
||||||
this.$emit('load');
|
this.$emit('load');
|
||||||
}
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
clickErrorText() {
|
clickErrorText() {
|
||||||
this.$emit('update:error', false);
|
this.$emit('update:error', false);
|
||||||
this.$nextTick(this.check);
|
this.check();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const Placeholder = <div ref="placeholder" class={bem('placeholder')}/>;
|
const Placeholder = <div ref="placeholder" class={bem('placeholder')} />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={bem()} role="feed" aria-busy={this.loading}>
|
<div class={bem()} role="feed" aria-busy={this.loading}>
|
||||||
|
@ -4,7 +4,7 @@ import { BindEventMixin } from './bind-event';
|
|||||||
|
|
||||||
export const CloseOnPopstateMixin = Vue.extend({
|
export const CloseOnPopstateMixin = Vue.extend({
|
||||||
mixins: [
|
mixins: [
|
||||||
BindEventMixin(function (this: any, bind, isBind) {
|
BindEventMixin(function(this: any, bind, isBind) {
|
||||||
this.handlePopstate(isBind && this.closeOnPopstate);
|
this.handlePopstate(isBind && this.closeOnPopstate);
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
|
@ -9,7 +9,7 @@ const DELETE_KEY_THEME = ['delete', 'big', 'gray'];
|
|||||||
|
|
||||||
export default createComponent({
|
export default createComponent({
|
||||||
mixins: [
|
mixins: [
|
||||||
BindEventMixin(function (bind) {
|
BindEventMixin(function(bind) {
|
||||||
if (this.hideOnClickOutside) {
|
if (this.hideOnClickOutside) {
|
||||||
bind(document.body, 'touchstart', this.onBlur);
|
bind(document.body, 'touchstart', this.onBlur);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ const [createComponent, bem] = createNamespace('sticky');
|
|||||||
|
|
||||||
export default createComponent({
|
export default createComponent({
|
||||||
mixins: [
|
mixins: [
|
||||||
BindEventMixin(function (bind) {
|
BindEventMixin(function(bind) {
|
||||||
if (!this.scroller) {
|
if (!this.scroller) {
|
||||||
this.scroller = getScrollEventTarget(this.$el);
|
this.scroller = getScrollEventTarget(this.$el);
|
||||||
}
|
}
|
||||||
|
@ -327,7 +327,7 @@
|
|||||||
// List
|
// List
|
||||||
@list-icon-margin-right: 5px;
|
@list-icon-margin-right: 5px;
|
||||||
@list-text-color: @gray-dark;
|
@list-text-color: @gray-dark;
|
||||||
@list-text-font-size: @font-size-sm;
|
@list-text-font-size: @font-size-md;
|
||||||
@list-text-line-height: 50px;
|
@list-text-line-height: 50px;
|
||||||
|
|
||||||
// Loading
|
// Loading
|
||||||
|
@ -10,7 +10,7 @@ const [createComponent, bem] = createNamespace('swipe');
|
|||||||
export default createComponent({
|
export default createComponent({
|
||||||
mixins: [
|
mixins: [
|
||||||
TouchMixin,
|
TouchMixin,
|
||||||
BindEventMixin(function (bind, isBind) {
|
BindEventMixin(function(bind, isBind) {
|
||||||
bind(window, 'resize', this.onResize, true);
|
bind(window, 'resize', this.onResize, true);
|
||||||
|
|
||||||
if (isBind) {
|
if (isBind) {
|
||||||
|
@ -13,7 +13,7 @@ const [createComponent, bem] = createNamespace('tabs');
|
|||||||
export default createComponent({
|
export default createComponent({
|
||||||
mixins: [
|
mixins: [
|
||||||
ParentMixin('vanTabs'),
|
ParentMixin('vanTabs'),
|
||||||
BindEventMixin(function (bind) {
|
BindEventMixin(function(bind) {
|
||||||
bind(window, 'resize', this.setLine, true);
|
bind(window, 'resize', this.setLine, true);
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
@ -148,7 +148,12 @@ export default createComponent({
|
|||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
const { titles } = this.$refs;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ function prefix(name: string, mods: Mods): Mods {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function createBEM(name: string) {
|
export function createBEM(name: string) {
|
||||||
return function (el?: Mods, mods?: Mods): Mods {
|
return function(el?: Mods, mods?: Mods): Mods {
|
||||||
if (el && typeof el !== 'string') {
|
if (el && typeof el !== 'string') {
|
||||||
mods = el;
|
mods = el;
|
||||||
el = '';
|
el = '';
|
||||||
|
@ -5,7 +5,7 @@ import locale from '../../locale';
|
|||||||
export function createI18N(name: string) {
|
export function createI18N(name: string) {
|
||||||
const prefix = camelize(name) + '.';
|
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);
|
const message = get(locale.messages(), prefix + path) || get(locale.messages(), path);
|
||||||
return typeof message === 'function' ? message(...args) : message;
|
return typeof message === 'function' ? message(...args) : message;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user