This commit is contained in:
Ling53666
2025-08-18 09:11:51 +08:00
commit 02554225da
2516 changed files with 133155 additions and 0 deletions

View File

@ -0,0 +1 @@
.ant-tab-bar-wrap{display:flex;align-items:center;background-color:#fff}.ant-tab-bar-item{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:4px 0;color:#666}.ant-tab-bar-item-active{color:#1677ff}.ant-tab-bar-icon{max-width:24px;max-height:24px;font-size:24px}.ant-tab-bar-image{font-size:24px;max-width:24px;max-height:24px}.ant-tab-bar-text{font-size:10px}

View File

@ -0,0 +1,66 @@
<view
class="ant-tab-bar {{className || ''}}"
style="{{style || ''}}"
>
<view class="ant-tab-bar-wrap">
<block
a:for="{{items}}"
a:for-index="index"
a:for-item="item"
>
<view
class="ant-tab-bar-item {{index === mixin.value ? 'ant-tab-bar-item-active ' + (activeClassName || '') : ''}}"
style="{{index === mixin.value ? activeStyle || '' : ''}}"
onTap="onChange"
data-index="{{index}}"
>
<ant-badge
a:if="{{item.badge}}"
type="{{item.badge.type || 'dot'}}"
text="{{item.badge.text}}"
stroke="{{item.badge.stroke}}"
bgColor="{{item.badge.bgColor}}"
position="{{item.badge.position || 'top-right'}}"
offsetX="{{item.badge.offsetX || '-9px'}}"
offsetY="{{item.badge.offsetY || '0px'}}"
>
<slot
name="icon"
active="{{mixin.value == index}}"
item="{{item}}"
index="{{index}}"
>
<image-icon
className="ant-tab-bar"
image="{{mixin.value === index ? item.activeIcon : item.icon}}"
></image-icon>
</slot>
</ant-badge>
<block a:else>
<slot
name="icon"
active="{{mixin.value == index}}"
item="{{item}}"
index="{{index}}"
>
<image-icon
className="ant-tab-bar"
image="{{mixin.value === index ? item.activeIcon : item.icon}}"
></image-icon>
</slot>
</block>
<view class="ant-tab-bar-text-wrap">
<slot
name="text"
active="{{mixin.value === index}}"
item="{{item}}"
index="{{index}}"
>
<!--display: inline-->
<text class="ant-tab-bar-text">{{item.text}}</text>
</slot>
</view>
</view>
</block>
</view>
</view>

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,20 @@
import { TabBarDefaultProps } from './props';
import { Component, triggerEvent } from '../_util/simply';
import mixinValue from '../mixins/value';
Component(TabBarDefaultProps, {
onChange: function (e) {
var index = e.currentTarget.dataset.index;
if (index === this.getValue()) {
return;
}
if (!this.isControlled()) {
this.update(index);
}
triggerEvent(this, 'change', index, e);
},
}, null, [
mixinValue({
valueKey: 'current',
defaultValueKey: 'defaultCurrent',
}),
]);

View File

@ -0,0 +1,7 @@
{
"component": true,
"usingComponents": {
"ant-badge": "../Badge/index",
"image-icon": "../ImageIcon/index"
}
}

View File

@ -0,0 +1,55 @@
import { IBaseProps } from '../_util/base';
import { IBadgeProps } from '../Badge/props';
export interface ITabItem {
/**
* @description 底部图标,支持 Icon 或图片
* @default ''
*/
icon?: string;
/**
* @description 高亮状态的底部图标,支持 Icon 或图片
* @default ''
*/
activeIcon?: string;
/**
* @description 底部的文本信息
* @default ''
*/
text: string;
/**
* @description 徽标,参见 <Badge/> 组件
* @default undefined
*/
badge?: IBadgeProps;
}
/**
* @description 标签栏,内部配合 TabItem 使用。
*/
export interface ITabBarProps extends IBaseProps {
/**
* @description tabbar 配置,为一个数组
* @default []
*/
items: ITabItem[];
/**
* @description 选中
*/
current: number;
/**
* @description 初始值
*/
defaultCurrent: number;
/**
* @description 高亮状态图标和文本的 className
*/
activeClassName?: string;
/**
* @description 高亮状态图标和文本的 style
*/
activeStyle?: string;
/**
* @description tabbar 切换时的回调
*/
onChange: (index: number, e: Record<string, any>) => void;
}
export declare const TabBarDefaultProps: Partial<ITabBarProps>;

View File

@ -0,0 +1,7 @@
export var TabBarDefaultProps = {
items: [],
current: null,
defaultCurrent: 0,
activeClassName: '',
activeStyle: '',
};