Closed jaune162 closed 2 months ago
[https://stackblitz.com//github.com/jaune162/stackBlitz-tarters-i92r4w] S-I92R4W)
https://stackblitz.com/~/github.com/jaune162/stackblitz-starters- I92R4W has given code.
? ID = 001
This is to find that when the mouse pointed at any Tab, the link prompted below the browser has parameters with ? ID = 001
.
app.component.ts`` tabs
variable content is as follows:
`json [ {{ closeable: false, name: 'Homepage', queryparames: {}, routerlink: '/welcome' }, {{ closeable: false, name: 'tab1', queryparames: {}, routerlink: '/tabs/page1' }, {{ closeable: false, name: 'tab2', queryparames: {id: '001'}, routerlink: '/tabs/page2' } ]
`
The homepage and TAB1 should not have parameters in a tab, and when clicking TAB to jump, there should not be parameters.
All TAB will have parameters
ENVIRONMENT | Info |
---|---|
ng-zorro-antd | 18.0.0 |
Browser | Google Chrome |
问题在于 queryParamsHandling="merge"
这个参数上,此参数会合并现有参数和已有参数,最终导致打开的页面越多追加的参数就越多。
文档地址:https://angular.dev/api/router/QueryParamsHandling#
删除此参数即可解决上述问题。
Reproduction link
https://stackblitz.com/~/github.com/jaune162/stackblitz-starters-i92r4w
Steps to reproduce
https://stackblitz.com/~/github.com/jaune162/stackblitz-starters-i92r4w 中已给出代码。
?id=001
这是会发现当鼠标指向 任何一个tab时,浏览器下方提示的链接中都带有
?id=001
的参数。app.component.ts
中的tabs
变量内容如下:What is expected?
首页 和 Tab1 这连个tab中不应该带有参数,并且点击tab跳转时,不应该有参数。
What is actually happening?
所有 tab 中都会带有参数