dva.js如何在登陆时访问多个网址

我写了个websocket。
用户登陆时,点击登陆按钮后还要访问
http://localhost:8866/bbs/websocket/login/3
http://localhost:8866/bbs/websocket/send/3
这两个网址,websocket才能连通。
点击登陆按钮后最后访问到
http://localhost:8000/dashboard

等于说点击登陆后要访问3个网址,最后一个是http://localhost:8000/dashboard

请问这个功能怎么实现?

阅读 2.8k
2 个回答

modelsubscirptions中监听路由的变化,当pathname === '登录页面'时,加载两个websocket
单击按钮时,在onClick中执行dispatch一个effects中,调用最后一个接口。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进