mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-09-11 15:19:45 +08:00
[bugfix] Tab: 修复极端情况激活态异常
This commit is contained in:
parent
5addfd8526
commit
e5945c5459
@ -1,23 +1,22 @@
|
|||||||
function isDef(value: any): boolean {
|
export function isDef(value: any): boolean {
|
||||||
return value !== undefined && value !== null;
|
return value !== undefined && value !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isObj(x: any): boolean {
|
export function isObj(x: any): boolean {
|
||||||
const type = typeof x;
|
const type = typeof x;
|
||||||
return x !== null && (type === 'object' || type === 'function');
|
return x !== null && (type === 'object' || type === 'function');
|
||||||
}
|
}
|
||||||
|
|
||||||
function isNumber(value) {
|
export function isNumber(value) {
|
||||||
return /^\d+$/.test(value);
|
return /^\d+$/.test(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function range(num: number, min: number, max: number) {
|
export function range(num: number, min: number, max: number) {
|
||||||
return Math.min(Math.max(num, min), max);
|
return Math.min(Math.max(num, min), max);
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export function nextTick(fn: Function) {
|
||||||
isObj,
|
setTimeout(() => {
|
||||||
isDef,
|
fn();
|
||||||
isNumber,
|
}, 1000 / 30);
|
||||||
range
|
}
|
||||||
};
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { VantComponent } from '../common/component';
|
import { VantComponent } from '../common/component';
|
||||||
import { touch } from '../mixins/touch';
|
import { touch } from '../mixins/touch';
|
||||||
import { Weapp } from 'definitions/weapp';
|
import { Weapp } from 'definitions/weapp';
|
||||||
|
import { nextTick } from '../common/utils';
|
||||||
|
|
||||||
type TabItemData = {
|
type TabItemData = {
|
||||||
width?: number
|
width?: number
|
||||||
@ -236,7 +237,7 @@ VantComponent({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.set({}, () => {
|
nextTick(() => {
|
||||||
this.setLine();
|
this.setLine();
|
||||||
this.setTrack();
|
this.setTrack();
|
||||||
this.scrollIntoView();
|
this.scrollIntoView();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user