Files
gitlab-instance-0a899031_yi…/src/componments/TabbarCom/index.jsx
2024-03-19 21:21:18 +08:00

36 lines
938 B
JavaScript

import { View } from "@tarojs/components";
import { AtAvatar, AtTag, AtIcon, AtTabBar, AtButton } from "taro-ui";
import Taro from "@tarojs/taro";
import react from "react";
const TabbarCom = (props) => {
const [active, setActive] = react.useState(props?.active ?? 0);
return (
<View className="tabbbar">
<AtTabBar
tabList={[
{ title: "首页", iconType: "home" }, //, text: "new"
// { title: "活动", iconType: "camera" },
{ title: "我的", iconType: "user" }, //, text: "100", max: 99
]}
onClick={(current) => {
setActive(current)
if (current === 0) {
Taro.redirectTo({
url: "/pages/index/index",
});
}else{
Taro.redirectTo({
url: "/pages/my/index",
});
}
}}
current={active}
/>
</View>
);
};
export default TabbarCom;