From a968639aa440a2c2187b98af3f8cb84eb82f08ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=B3=A2?= Date: Sat, 11 Apr 2020 14:38:19 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AEmobx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/{index.css => index.scss} | 0 src/index.tsx | 2 +- src/store/modules/user.ts | 2 +- src/views/home/HomePage.tsx | 10 +++++++--- 4 files changed, 9 insertions(+), 5 deletions(-) rename src/{index.css => index.scss} (100%) diff --git a/src/index.css b/src/index.scss similarity index 100% rename from src/index.css rename to src/index.scss diff --git a/src/index.tsx b/src/index.tsx index c1081eb..5f7d66d 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,7 +1,7 @@ import React from 'react' import ReactDOM from 'react-dom' import { Provider } from 'mobx-react' -import './index.css' +import './index.scss' import App from './App' import * as store from './store' import * as serviceWorker from './serviceWorker' diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 2ef11e5..3b8dbd5 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -9,7 +9,7 @@ interface StateProps { } class UserStore implements UserStoreStates { @observable state = { - name: 'userStrore' + name: 'userStore' } @action diff --git a/src/views/home/HomePage.tsx b/src/views/home/HomePage.tsx index e2fa891..f954871 100644 --- a/src/views/home/HomePage.tsx +++ b/src/views/home/HomePage.tsx @@ -2,12 +2,16 @@ import React from 'react' import { inject, observer } from 'mobx-react' import { useOnEnter } from '@/hooks/index' -const HomePage: React.FC = () => { +const HomePage: React.FC = (props: any) => { + const { userStore: store } = props useOnEnter(() => { - console.log('dad') + console.log('enter') }) return ( -
主页
+
+

首页

+

{store.state.name}

+
) } -- Gitee