mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
fix: 调整tab wrap-class位置及cascader review细节问题
This commit is contained in:
parent
88eb9379a9
commit
c1abd0052f
@ -1,5 +1,28 @@
|
|||||||
import { VantComponent } from '../../common/component';
|
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 = [
|
const zhCNOptions = [
|
||||||
{
|
{
|
||||||
|
@ -68,10 +68,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__selected-icon {
|
|
||||||
font-size: @cascader-selected-icon-size !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__options {
|
&__options {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
height: @cascader-options-height;
|
height: @cascader-options-height;
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
bind:tap="onSelect"
|
bind:tap="onSelect"
|
||||||
>
|
>
|
||||||
<text>{{ option[textKey] }}</text>
|
<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>
|
</view>
|
||||||
<!-- 暂不支持 -->
|
<!-- 暂不支持 -->
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { isDef, isNumber, isPlainObject, isPromise, isObj } from './validator';
|
import { isDef, isNumber, isPlainObject, isPromise } from './validator';
|
||||||
import {
|
import {
|
||||||
canIUseGroupSetData,
|
canIUseGroupSetData,
|
||||||
canIUseNextTick,
|
canIUseNextTick,
|
||||||
@ -116,27 +116,3 @@ export function getCurrentPage<T>() {
|
|||||||
const pages = getCurrentPages();
|
const pages = getCurrentPages();
|
||||||
return pages[pages.length - 1] as T & WechatMiniprogram.Page.TrivialInstance;
|
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;
|
|
||||||
}
|
|
||||||
|
@ -70,7 +70,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
style="z-index:1"
|
style="z-index:1"
|
||||||
>
|
>
|
||||||
<wx-view
|
<wx-view
|
||||||
class="wrap-class van-tabs__wrap "
|
class="van-tabs__wrap wrap-class"
|
||||||
>
|
>
|
||||||
<wx-scroll-view
|
<wx-scroll-view
|
||||||
class="van-tabs__scroll van-tabs__scroll--line"
|
class="van-tabs__scroll van-tabs__scroll--line"
|
||||||
|
@ -20,7 +20,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
style="z-index:1"
|
style="z-index:1"
|
||||||
>
|
>
|
||||||
<wx-view
|
<wx-view
|
||||||
class="wrap-class van-tabs__wrap "
|
class="van-tabs__wrap wrap-class"
|
||||||
>
|
>
|
||||||
<wx-scroll-view
|
<wx-scroll-view
|
||||||
class="van-tabs__scroll van-tabs__scroll--line"
|
class="van-tabs__scroll van-tabs__scroll--line"
|
||||||
|
@ -20,7 +20,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
style="z-index:1"
|
style="z-index:1"
|
||||||
>
|
>
|
||||||
<wx-view
|
<wx-view
|
||||||
class="wrap-class van-tabs__wrap "
|
class="van-tabs__wrap wrap-class"
|
||||||
>
|
>
|
||||||
<wx-scroll-view
|
<wx-scroll-view
|
||||||
class="van-tabs__scroll van-tabs__scroll--line"
|
class="van-tabs__scroll van-tabs__scroll--line"
|
||||||
|
@ -250,6 +250,7 @@ Page({
|
|||||||
| nav-class | 标签栏样式类 |
|
| nav-class | 标签栏样式类 |
|
||||||
| tab-class | 标签样式类 |
|
| tab-class | 标签样式类 |
|
||||||
| tab-active-class | 标签激活态样式类 |
|
| tab-active-class | 标签激活态样式类 |
|
||||||
|
| wrap-class | 标签栏根节点样式类 |
|
||||||
|
|
||||||
### 方法
|
### 方法
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
style="z-index:1"
|
style="z-index:1"
|
||||||
>
|
>
|
||||||
<wx-view
|
<wx-view
|
||||||
class="wrap-class van-tabs__wrap "
|
class="van-tabs__wrap wrap-class"
|
||||||
>
|
>
|
||||||
<wx-scroll-view
|
<wx-scroll-view
|
||||||
class="van-tabs__scroll van-tabs__scroll--line"
|
class="van-tabs__scroll van-tabs__scroll--line"
|
||||||
@ -186,7 +186,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
style="z-index:1"
|
style="z-index:1"
|
||||||
>
|
>
|
||||||
<wx-view
|
<wx-view
|
||||||
class="wrap-class van-tabs__wrap "
|
class="van-tabs__wrap wrap-class"
|
||||||
>
|
>
|
||||||
<wx-scroll-view
|
<wx-scroll-view
|
||||||
class="van-tabs__scroll van-tabs__scroll--line"
|
class="van-tabs__scroll van-tabs__scroll--line"
|
||||||
@ -322,7 +322,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
style="z-index:1"
|
style="z-index:1"
|
||||||
>
|
>
|
||||||
<wx-view
|
<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
|
<wx-scroll-view
|
||||||
class="van-tabs__scroll van-tabs__scroll--line"
|
class="van-tabs__scroll van-tabs__scroll--line"
|
||||||
@ -523,7 +523,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
style="z-index:1"
|
style="z-index:1"
|
||||||
>
|
>
|
||||||
<wx-view
|
<wx-view
|
||||||
class="wrap-class van-tabs__wrap "
|
class="van-tabs__wrap wrap-class"
|
||||||
>
|
>
|
||||||
<wx-scroll-view
|
<wx-scroll-view
|
||||||
class="van-tabs__scroll van-tabs__scroll--line"
|
class="van-tabs__scroll van-tabs__scroll--line"
|
||||||
@ -661,7 +661,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
style="z-index:1"
|
style="z-index:1"
|
||||||
>
|
>
|
||||||
<wx-view
|
<wx-view
|
||||||
class="wrap-class van-tabs__wrap "
|
class="van-tabs__wrap wrap-class"
|
||||||
>
|
>
|
||||||
<wx-scroll-view
|
<wx-scroll-view
|
||||||
class="van-tabs__scroll van-tabs__scroll--card"
|
class="van-tabs__scroll van-tabs__scroll--card"
|
||||||
@ -795,7 +795,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
style="z-index:1"
|
style="z-index:1"
|
||||||
>
|
>
|
||||||
<wx-view
|
<wx-view
|
||||||
class="wrap-class van-tabs__wrap "
|
class="van-tabs__wrap wrap-class"
|
||||||
>
|
>
|
||||||
<wx-scroll-view
|
<wx-scroll-view
|
||||||
class="van-tabs__scroll van-tabs__scroll--line"
|
class="van-tabs__scroll van-tabs__scroll--line"
|
||||||
@ -910,7 +910,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
style="z-index:1"
|
style="z-index:1"
|
||||||
>
|
>
|
||||||
<wx-view
|
<wx-view
|
||||||
class="wrap-class van-tabs__wrap "
|
class="van-tabs__wrap wrap-class"
|
||||||
>
|
>
|
||||||
<wx-scroll-view
|
<wx-scroll-view
|
||||||
class="van-tabs__scroll van-tabs__scroll--line"
|
class="van-tabs__scroll van-tabs__scroll--line"
|
||||||
@ -1067,7 +1067,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
style="z-index:1"
|
style="z-index:1"
|
||||||
>
|
>
|
||||||
<wx-view
|
<wx-view
|
||||||
class="wrap-class van-tabs__wrap "
|
class="van-tabs__wrap wrap-class"
|
||||||
>
|
>
|
||||||
<wx-scroll-view
|
<wx-scroll-view
|
||||||
class="van-tabs__scroll van-tabs__scroll--line"
|
class="van-tabs__scroll van-tabs__scroll--line"
|
||||||
@ -1224,7 +1224,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
style="z-index:1"
|
style="z-index:1"
|
||||||
>
|
>
|
||||||
<wx-view
|
<wx-view
|
||||||
class="wrap-class van-tabs__wrap "
|
class="van-tabs__wrap wrap-class"
|
||||||
>
|
>
|
||||||
<wx-scroll-view
|
<wx-scroll-view
|
||||||
class="van-tabs__scroll van-tabs__scroll--line"
|
class="van-tabs__scroll van-tabs__scroll--line"
|
||||||
@ -1385,7 +1385,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
style="z-index:1"
|
style="z-index:1"
|
||||||
>
|
>
|
||||||
<wx-view
|
<wx-view
|
||||||
class="wrap-class van-tabs__wrap "
|
class="van-tabs__wrap wrap-class"
|
||||||
>
|
>
|
||||||
<wx-scroll-view
|
<wx-scroll-view
|
||||||
class="van-tabs__scroll van-tabs__scroll--line"
|
class="van-tabs__scroll van-tabs__scroll--line"
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
container="{{ container }}"
|
container="{{ container }}"
|
||||||
bind:scroll="onTouchScroll"
|
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" />
|
<slot name="nav-left" />
|
||||||
|
|
||||||
<scroll-view
|
<scroll-view
|
||||||
|
Loading…
x
Reference in New Issue
Block a user