底部tabbar子组件
This commit is contained in:
35
src/componments/TabbarCom/index.jsx
Normal file
35
src/componments/TabbarCom/index.jsx
Normal file
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user