feat: 新增我的页面,以及tabbar跳转

This commit is contained in:
hackrobot
2024-03-19 19:50:12 +08:00
parent f96694adb2
commit 0b4be1572d
4 changed files with 70 additions and 3 deletions

View File

@@ -1,6 +1,8 @@
export default defineAppConfig({
pages: [
'pages/index/index'
'pages/index/index',
'pages/my/index',
],
window: {
backgroundTextStyle: 'light',

View File

@@ -188,8 +188,14 @@ export default function Index() {
// { title: "活动", iconType: "camera" },
{ title: "我的", iconType: "user" }, //, text: "100", max: 99
]}
// onClick={this.handleClick.bind(this)}
// current={this.state.current}
onClick={(current)=>{
if (current !== 0) {
Taro.redirectTo({
url: "/pages/my/index",
});
}
}}
current={0}
/>
</View>
</View>

42
src/pages/my/index.jsx Normal file
View File

@@ -0,0 +1,42 @@
import { View, Text, Image } from "@tarojs/components";
import { useLoad } from "@tarojs/taro";
import Taro from "@tarojs/taro";
import { AtAvatar, AtTag, AtIcon, AtTabBar, AtButton } from "taro-ui";
import "./index.scss";
import beijing from "@/images/city/beijing.jpg";
import guangzhou from "@/images/city/guangzhou.jpg";
import shanghai from "@/images/city/shanghai.jpg";
import shenzhen from "@/images/city/shenzhen.jpg";
import touxiang from "@/images/index/touxiang.jpg";
import { useEffect, useState } from "react";
const my = () => {
return (
<View className="my">
<View className="myContent">
my
{/* 底部tabbar */}
<View className="tabbbar">
<AtTabBar
tabList={[
{ title: "首页", iconType: "home" }, //, text: "new"
// { title: "活动", iconType: "camera" },
{ title: "我的", iconType: "user" }, //, text: "100", max: 99
]}
onClick={(current) => {
console.log("current", current);
if (current !== 1) {
Taro.redirectTo({
url: "/pages/index/index",
});
}
}}
current={1}
/>
</View>
</View>
</View>
);
};
export default my;

17
src/pages/my/index.scss Normal file
View File

@@ -0,0 +1,17 @@
.my{
.myContent{
padding-left: 20px;
padding-right: 20px;
}
.tabbbarDiv {
width: 100%;
height: 140px;
// background-color: red;
}
.tabbbar {
position: fixed;
bottom: 0px;
width: 100%;
}
}