Leanote's Blog
I love Leanote!
Toggle navigation
Leanote's Blog
Home
Chrome
Git
Linux
Windows
Others
工具大全
VsCode
Expo
Html
JavaScript
Npm
Node
Mock
React-Native
React
TypeScript
小程序
插件
正则
Dva
Ant-Design-React
Umi
Vue
Vux
Ant-Design-Vue
Http
Java
flutter
开发小工具
About Me
Archives
Tags
export注意点
2019-11-14 07:46:47
9
0
0
admin
## react里一个组件如果是被路由直接require导入进路由配置里的话, 当前组件里不能写`export const xxx = xxx;`, 会导致路由错乱跳到首页. (个人理解: 可能是导入的时候认为一个组件里的export default和export xxx的问题) 可以写`export default xxx` router.js: { path: 'firmwareUpdate/:record',//OTA固件升级详情 getComponent(nextState, cb) { pathChange = false; require.ensure([], require => { registerModel(app, require('./models/firmwareUpdate')); if (!pathChange) { cb(null, require('./routes/firmwareUpdate/detail'));//**注意**这样引入的组件里面不能写export xxx } }, 'firmwareUpdate'); }, }, xxx.js class Xxx extends Component{ } export default connect(({a})=> ({a}))(Xxx);//这样正常
Pre:
dva下的router(路由跳转传参)
Next:
dva基础(书签大全)
0
likes
9
Weibo
Wechat
Tencent Weibo
QQ Zone
RenRen
Submit
Sign in
to leave a comment.
No Leanote account?
Sign up now.
0
comments
More...
Table of content
No Leanote account? Sign up now.