fix: 调整tab wrap-class位置及cascader review细节问题

This commit is contained in:
yangjinfeng 2022-12-09 18:26:48 +08:00
parent 88eb9379a9
commit c1abd0052f
10 changed files with 41 additions and 45 deletions

View File

@ -1,5 +1,28 @@
import { VantComponent } from '../../common/component';
import { deepClone } from '../../common/utils';
import { isDef } from '../../common/utils';
import { isObj } from '../../common/validator';
function deepClone<T extends Record<string, any>>(obj: T): T {
if (!isDef(obj)) {
return obj;
}
if (Array.isArray(obj)) {
return obj.map((item) => deepClone(item)) as unknown as T;
}
if (isObj(obj)) {
const to = {} as Record<string, any>;
Object.keys(obj).forEach((key: string) => {
// @ts-ignore
to[key] = deepClone(obj[key]);
});
return to as T;
}
return obj;
}
const zhCNOptions = [
{

View File

@ -68,10 +68,6 @@
}
}
&__selected-icon {
font-size: @cascader-selected-icon-size !important;
}
&__options {
box-sizing: border-box;
height: @cascader-options-height;

View File

@ -44,7 +44,7 @@
bind:tap="onSelect"
>
<text>{{ option[textKey] }}</text>
<van-icon wx:if="{{ utils.isSelected(tab, textKey, option) }}" name="success" custom-class="van-cascader__selected-icon" />
<van-icon wx:if="{{ utils.isSelected(tab, textKey, option) }}" name="success" size="18" />
</view>
</view>
<!-- 暂不支持 -->

View File

@ -1,4 +1,4 @@
import { isDef, isNumber, isPlainObject, isPromise, isObj } from './validator';
import { isDef, isNumber, isPlainObject, isPromise } from './validator';
import {
canIUseGroupSetData,
canIUseNextTick,
@ -116,27 +116,3 @@ export function getCurrentPage<T>() {
const pages = getCurrentPages();
return pages[pages.length - 1] as T & WechatMiniprogram.Page.TrivialInstance;
}
export function deepClone<T extends Record<string, any> | null | undefined>(
obj: T
): T {
if (!isDef(obj)) {
return obj;
}
if (Array.isArray(obj)) {
return obj.map((item) => deepClone(item)) as unknown as T;
}
if (isObj(obj)) {
const to = {} as Record<string, any>;
Object.keys(obj).forEach((key: string) => {
// @ts-ignore
to[key] = deepClone(obj[key]);
});
return to as T;
}
return obj;
}

View File

@ -70,7 +70,7 @@ exports[`should render demo and match snapshot 1`] = `
style="z-index:1"
>
<wx-view
class="wrap-class van-tabs__wrap "
class="van-tabs__wrap wrap-class"
>
<wx-scroll-view
class="van-tabs__scroll van-tabs__scroll--line"

View File

@ -20,7 +20,7 @@ exports[`should render demo and match snapshot 1`] = `
style="z-index:1"
>
<wx-view
class="wrap-class van-tabs__wrap "
class="van-tabs__wrap wrap-class"
>
<wx-scroll-view
class="van-tabs__scroll van-tabs__scroll--line"

View File

@ -20,7 +20,7 @@ exports[`should render demo and match snapshot 1`] = `
style="z-index:1"
>
<wx-view
class="wrap-class van-tabs__wrap "
class="van-tabs__wrap wrap-class"
>
<wx-scroll-view
class="van-tabs__scroll van-tabs__scroll--line"

View File

@ -250,6 +250,7 @@ Page({
| nav-class | 标签栏样式类 |
| tab-class | 标签样式类 |
| tab-active-class | 标签激活态样式类 |
| wrap-class | 标签栏根节点样式类 |
### 方法

View File

@ -29,7 +29,7 @@ exports[`should render demo and match snapshot 1`] = `
style="z-index:1"
>
<wx-view
class="wrap-class van-tabs__wrap "
class="van-tabs__wrap wrap-class"
>
<wx-scroll-view
class="van-tabs__scroll van-tabs__scroll--line"
@ -186,7 +186,7 @@ exports[`should render demo and match snapshot 1`] = `
style="z-index:1"
>
<wx-view
class="wrap-class van-tabs__wrap "
class="van-tabs__wrap wrap-class"
>
<wx-scroll-view
class="van-tabs__scroll van-tabs__scroll--line"
@ -322,7 +322,7 @@ exports[`should render demo and match snapshot 1`] = `
style="z-index:1"
>
<wx-view
class="wrap-class van-tabs__wrap van-tabs__wrap--scrollable "
class="van-tabs__wrap van-tabs__wrap--scrollable wrap-class"
>
<wx-scroll-view
class="van-tabs__scroll van-tabs__scroll--line"
@ -523,7 +523,7 @@ exports[`should render demo and match snapshot 1`] = `
style="z-index:1"
>
<wx-view
class="wrap-class van-tabs__wrap "
class="van-tabs__wrap wrap-class"
>
<wx-scroll-view
class="van-tabs__scroll van-tabs__scroll--line"
@ -661,7 +661,7 @@ exports[`should render demo and match snapshot 1`] = `
style="z-index:1"
>
<wx-view
class="wrap-class van-tabs__wrap "
class="van-tabs__wrap wrap-class"
>
<wx-scroll-view
class="van-tabs__scroll van-tabs__scroll--card"
@ -795,7 +795,7 @@ exports[`should render demo and match snapshot 1`] = `
style="z-index:1"
>
<wx-view
class="wrap-class van-tabs__wrap "
class="van-tabs__wrap wrap-class"
>
<wx-scroll-view
class="van-tabs__scroll van-tabs__scroll--line"
@ -910,7 +910,7 @@ exports[`should render demo and match snapshot 1`] = `
style="z-index:1"
>
<wx-view
class="wrap-class van-tabs__wrap "
class="van-tabs__wrap wrap-class"
>
<wx-scroll-view
class="van-tabs__scroll van-tabs__scroll--line"
@ -1067,7 +1067,7 @@ exports[`should render demo and match snapshot 1`] = `
style="z-index:1"
>
<wx-view
class="wrap-class van-tabs__wrap "
class="van-tabs__wrap wrap-class"
>
<wx-scroll-view
class="van-tabs__scroll van-tabs__scroll--line"
@ -1224,7 +1224,7 @@ exports[`should render demo and match snapshot 1`] = `
style="z-index:1"
>
<wx-view
class="wrap-class van-tabs__wrap "
class="van-tabs__wrap wrap-class"
>
<wx-scroll-view
class="van-tabs__scroll van-tabs__scroll--line"
@ -1385,7 +1385,7 @@ exports[`should render demo and match snapshot 1`] = `
style="z-index:1"
>
<wx-view
class="wrap-class van-tabs__wrap "
class="van-tabs__wrap wrap-class"
>
<wx-scroll-view
class="van-tabs__scroll van-tabs__scroll--line"

View File

@ -9,7 +9,7 @@
container="{{ container }}"
bind:scroll="onTouchScroll"
>
<view class="wrap-class {{ utils.bem('tabs__wrap', { scrollable }) }} {{ type === 'line' && border ? 'van-hairline--top-bottom' : '' }}">
<view class="{{ utils.bem('tabs__wrap', { scrollable }) }} {{ type === 'line' && border ? 'van-hairline--top-bottom' : '' }} wrap-class">
<slot name="nav-left" />
<scroll-view