Compare commits
No commits in common. "7f84b72ddce450c99f63da33b8f377ed9ea820f6" and "07136449614ced3427c30380058d0dd952983640" have entirely different histories.
7f84b72ddc
...
0713644961
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"printWidth": 80,
|
||||
"printWidth": 120,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"semi": true,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ export default defineAppConfig({
|
|||
window: {
|
||||
backgroundTextStyle: 'light',
|
||||
navigationBarBackgroundColor: '#fff',
|
||||
navigationBarTitleText: 'EVA Notify',
|
||||
navigationBarTitleText: 'WeChat',
|
||||
navigationBarTextStyle: 'black',
|
||||
},
|
||||
tabBar: {
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
export default {
|
||||
component: true,
|
||||
};
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
@import "~taro-ui/dist/style/components/tab-bar.scss";
|
||||
@import "~taro-ui/dist/style/components/badge.scss";
|
||||
@import "~taro-ui/dist/style/components/icon.scss";
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
import { Component, ReactNode } from 'react';
|
||||
import { AtTabBar } from 'taro-ui';
|
||||
import Taro from '@tarojs/taro';
|
||||
import 'taro-ui/dist/style/index.scss';
|
||||
import './index.scss';
|
||||
|
||||
const navList: Array<Taro.TabBarItem> = [
|
||||
{
|
||||
pagePath: '/pages/index/index',
|
||||
text: '主页',
|
||||
},
|
||||
{
|
||||
pagePath: '/pages/repair/repair',
|
||||
text: '维修',
|
||||
},
|
||||
{
|
||||
pagePath: '/pages/user/user',
|
||||
text: '我的',
|
||||
},
|
||||
];
|
||||
|
||||
export default class Index extends Component {
|
||||
state = {
|
||||
selected: 0,
|
||||
tabList: [
|
||||
{
|
||||
title: '主页',
|
||||
iconType: 'home',
|
||||
},
|
||||
{
|
||||
title: '维修',
|
||||
iconType: 'settings',
|
||||
},
|
||||
{
|
||||
title: '我的',
|
||||
iconType: 'user',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
handleClick(idx: number) {
|
||||
this.switchTab(idx, navList[idx].pagePath);
|
||||
}
|
||||
|
||||
switchTab(idx: number, url: string) {
|
||||
this.setSelected(idx);
|
||||
Taro.switchTab({ url });
|
||||
}
|
||||
|
||||
setSelected(idx: number) {
|
||||
this.setState({
|
||||
selected: idx,
|
||||
});
|
||||
}
|
||||
|
||||
render(): ReactNode {
|
||||
return (
|
||||
<AtTabBar
|
||||
fixed
|
||||
tabList={this.state.tabList}
|
||||
onClick={this.handleClick.bind(this)}
|
||||
current={this.state.selected}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
export default definePageConfig({
|
||||
navigationBarTitleText: '首页',
|
||||
usingComponents: {},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import { View, Text } from '@tarojs/components';
|
||||
import { Component, ReactNode } from 'react';
|
||||
import Taro from '@tarojs/taro';
|
||||
import type CustomTabBar from '../../custom-tab-bar';
|
||||
import { AtButton } from 'taro-ui';
|
||||
import './index.scss';
|
||||
|
||||
class Index extends Component {
|
||||
|
|
@ -9,17 +8,14 @@ class Index extends Component {
|
|||
msg: 'Hello World!',
|
||||
};
|
||||
|
||||
// 以下是TabBar相关
|
||||
pageCtx = Taro.getCurrentInstance().page;
|
||||
componentDidShow() {
|
||||
const tabbar = Taro.getTabBar<CustomTabBar>(this.pageCtx);
|
||||
tabbar?.setSelected(0);
|
||||
onReady() {
|
||||
console.log('Index is ready');
|
||||
}
|
||||
// 以上是TabBar相关
|
||||
|
||||
render(): ReactNode {
|
||||
return (
|
||||
<View>
|
||||
<AtButton type='primary' size='normal'></AtButton>
|
||||
<Text>{this.state.msg}</Text>
|
||||
</View>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,18 +1,7 @@
|
|||
import { View, Text } from '@tarojs/components';
|
||||
import { Component, ReactNode } from 'react';
|
||||
import Taro from '@tarojs/taro';
|
||||
import type CustomTabBar from '../../custom-tab-bar';
|
||||
import './repair.scss';
|
||||
|
||||
export default class RepairPage extends Component {
|
||||
// 以下是TabBar相关
|
||||
pageCtx = Taro.getCurrentInstance().page;
|
||||
componentDidShow() {
|
||||
const tabbar = Taro.getTabBar<CustomTabBar>(this.pageCtx);
|
||||
tabbar?.setSelected(1);
|
||||
}
|
||||
// 以上是TabBar相关
|
||||
|
||||
render(): ReactNode {
|
||||
return (
|
||||
<View>
|
||||
|
|
|
|||
|
|
@ -1,18 +1,7 @@
|
|||
import { View, Text } from '@tarojs/components';
|
||||
import { Component, ReactNode } from 'react';
|
||||
import Taro from '@tarojs/taro';
|
||||
import type CustomTabBar from '../../custom-tab-bar';
|
||||
import './user.scss';
|
||||
|
||||
export default class UserPage extends Component {
|
||||
// 以下是TabBar相关
|
||||
pageCtx = Taro.getCurrentInstance().page;
|
||||
componentDidShow() {
|
||||
const tabbar = Taro.getTabBar<CustomTabBar>(this.pageCtx);
|
||||
tabbar?.setSelected(2);
|
||||
}
|
||||
// 以上是TabBar相关
|
||||
|
||||
render(): ReactNode {
|
||||
return (
|
||||
<View>
|
||||
|
|
|
|||
Loading…
Reference in New Issue