调试使用console.log(this.props);
可以打印出当前的属性。
state到底是什么
@connect((state)=>(state))
可以打印出state这个对象
{history: {…}, location: {…}, match: {…}, staticContext: undefined, computedMatch: {…}, …}
history: {length: 2, action: "POP", location: {…}, createHref: ƒ, push: ƒ, …}
location: {pathname: "/test", search: "", hash: "", query: {…}, state: undefined}
match: {path: "/test", url: "/test", isExact: true, params: {…}}
staticContext: undefined
computedMatch: {path: "/test", url: "/test", isExact: true, params: {…}}
route: {path: "/test", exact: true, component: ƒ}
children: null
router: {location: {…}, action: "POP"}
@@dva: 0
global: {collapsed: false, notices: Array(0)}
login: {status: undefined}
settings: {navTheme: "dark", primaryColor: "daybreak", layout: "sidemenu", contentWidth: "Fluid", fixedHeader: false, …}
user: {currentUser: {…}}
loading: {global: false, models: {…}, effects: {…}}
test: {status: 0}
dispatch: ƒ (action)
proto: Object
网友评论