File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change
1
+ import { Message } from 'umi';
2
+
1
3
# API
2
4
3
5
为方便查找,以下内容通过字母排序。
@@ -147,18 +149,30 @@ import { history } from 'umi';
147
149
history .push (' /list' );
148
150
149
151
// 带参数跳转到指定路由
150
- history .push (' /list?a=b&c=d#anchor' );
152
+ history .push (' /list?a=b&c=d#anchor' , state );
151
153
history .push ({
152
- pathname: ' /list' ,
153
- search: ' ?a=b&c=d' ,
154
- hash: ' anchor' ,
155
- });
154
+ pathname: ' /list' ,
155
+ search: ' ?a=b&c=d' ,
156
+ hash: ' anchor' ,
157
+ },
158
+ {
159
+ some: ' state-data' ,
160
+ }
161
+ );
162
+
163
+ // 跳转当前路径,并刷新 state
164
+ history .push ({}, state )
156
165
157
166
// 跳转到上一个路由
158
167
history .back ();
159
168
history .go (- 1 );
160
169
```
161
170
171
+ <Message emoji =" 🚨 " >
172
+ 注意:history.push 和 history.replace 需要使用 ` state ` 需将 ` state ` 作为这两个 API 的第二个参数传递
173
+ </Message >
174
+
175
+
162
176
路由监听。
163
177
164
178
``` ts
You can’t perform that action at this time.
0 commit comments