Compare commits

..

No commits in common. "7f84b72ddce450c99f63da33b8f377ed9ea820f6" and "07136449614ced3427c30380058d0dd952983640" have entirely different histories.

9 changed files with 7 additions and 104 deletions

View File

@ -1,5 +1,5 @@
{
"printWidth": 80,
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"semi": true,

View File

@ -3,7 +3,7 @@ export default defineAppConfig({
window: {
backgroundTextStyle: 'light',
navigationBarBackgroundColor: '#fff',
navigationBarTitleText: 'EVA Notify',
navigationBarTitleText: 'WeChat',
navigationBarTextStyle: 'black',
},
tabBar: {

View File

@ -1,3 +0,0 @@
export default {
component: true,
};

View File

@ -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";

View File

@ -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}
/>
);
}
}

View File

@ -1,3 +1,4 @@
export default definePageConfig({
navigationBarTitleText: '首页',
usingComponents: {},
});

View File

@ -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>
);

View File

@ -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>

View File

@ -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>