import './TopNavigationBar.less' import { ComponentType } from 'react' import Taro, { Component } from '@tarojs/taro' import { View } from '@tarojs/components' import { observer, inject } from '@tarojs/mobx' import { TopNavigationBarStore } from '@bageventjs/taro-store' type PageStateProps = { topNavigationBarStore: TopNavigationBarStore } interface TopNavigationBar { props: PageStateProps } @inject('topNavigationBarStore') @observer class TopNavigationBar extends Component { constructor(props) { super(props) this.props.topNavigationBarStore.constructor(props) } componentWillMount() { this.props.topNavigationBarStore.componentWillMount() } render() { const { topNavigationBarStore: { paddingTop, height, background, color, fontSize, fixed, show, showBackButton, backStyle, showHomeButton, navigationBarTextStyle, title, placeholderBg, }, topNavigationBarStore, } = this.props return ( {showBackButton && ( topNavigationBarStore.backPage()} /> {backStyle === 'normal' && } {showHomeButton && ( topNavigationBarStore.backHomePage()} > {backStyle === 'simple' ? '首页' : ''} )} )} {title} {fixed && show && ( )} ) } } export default TopNavigationBar as ComponentType