import React , { useEffect } from 'react' ; import { connect } from 'react-redux' ; import { AtButton } from 'taro-ui' ; import { View , Image , Text , Button } from '@tarojs/components' ; import { navigateTo , useDidHide , useDidShow } from '@tarojs/taro' ; import 'taro-ui/dist/style/components/button.scss' ; import styles from './index.module.scss' ; const Index = ( ) => { const init = async ( ) => { console . log ( '请求 数据' ) ; } ; useEffect ( ( ) => { init ( ) ; } , [ ] ) ; useDidShow ( ( ) => { console . log ( 'componentDidShow' ) ; } ) ; useDidHide ( ( ) => { console . log ( 'componentDidHide' ) ; } ) ; const goPage = ( ) => { navigateTo ( { url : '/pages/home2/index' , } ) ; } ; return ( < View className = { styles . indexBody } > < Image src = 'http://s.devland.cn/fa3f6cc819a8a316f924fb61c9478bfe.jpeg' className = { styles . icon } > < /Image> < Text className = { styles . desc } > 前端指北 < /Text> < AtButton type = 'secondary' className = { styles . routerLink } onClick = { ( ) => goPage ( ) } > 关注我 < /AtButton> { } < /View>); } ; export default connect ( ( { common } ) => ( { common , } ) , ( dispatch ) => { return { add : dispatch . common ?. increment , dec : dispatch . common ?. dec , login : dispatch . common . login , } ; } ) ( Index ) ;