feat: simpleify code

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2019-07-30 18:52:22 +08:00
parent 9de6a1eb36
commit d66c64fdff
3 changed files with 8 additions and 7 deletions

View File

@ -1,6 +1,5 @@
let mapDefaultProps = ({ def }) => ({ ...def }) let mapDefaultProps = (obj: any) => ((def) => ({ ...def[obj.name.toLowerCase()] }))
export { export {
mapDefaultProps mapDefaultProps
} }

View File

@ -9,8 +9,8 @@ import { mapDefaultProps } from '../../models/utils';
import './index.scss'; import './index.scss';
import { IndexProps, IndexState } from './type'; import { IndexProps, IndexState } from './type';
@connect(mapDefaultProps) @connect(mapDefaultProps(Index))
export default class Index extends Component<IndexProps, IndexState> { class Index extends Component<IndexProps, IndexState> {
config: Config = { config: Config = {
navigationBarTitleText: '首页', navigationBarTitleText: '首页',
enablePullDownRefresh: true enablePullDownRefresh: true
@ -55,3 +55,5 @@ export default class Index extends Component<IndexProps, IndexState> {
) )
} }
} }
export default Index

View File

@ -10,8 +10,8 @@ import defaultImage from '../../assets/images/logo.png';
import './index.scss'; import './index.scss';
import { MyIndexProps, MyState } from './type'; import { MyIndexProps, MyState } from './type';
@connect(mapDefaultProps) @connect(mapDefaultProps(My))
class Index extends Component<MyIndexProps, MyState> { class My extends Component<MyIndexProps, MyState> {
config: Config = { config: Config = {
navigationBarTitleText: '个人中心', navigationBarTitleText: '个人中心',
enablePullDownRefresh: true enablePullDownRefresh: true
@ -103,4 +103,4 @@ class Index extends Component<MyIndexProps, MyState> {
} }
} }
export default Index export default My