Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit 90bd9bb

Browse files
committed
fix: getChannelLink for dynamic params
1 parent 9d867e2 commit 90bd9bb

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

packages/build-tools/console-toolkit-plugin-xconsole/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@alicloud/console-toolkit-plugin-xconsole",
3-
"version": "2.3.41",
3+
"version": "2.3.42",
44
"repository": {
55
"type": "git",
66
"url": "https://github.com/aliyun/alibabacloud-console-design.git"

packages/console-utils/xconsole-context/src/console/ConsoleConfig.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import template from 'lodash/template'
12
import {
23
ChannelEnum,
34
IAliyunConsoleConfig,
@@ -104,14 +105,20 @@ class ConsoleConfig {
104105
return { status: false };
105106
};
106107

107-
public getChannelLink = (linkId: string): string => {
108+
public getChannelLink = (linkId: string, linkParams?: any): string => {
109+
let channelLink = 'javascript:void(0)';
108110
if (
109111
this.consoleConfig.CHANNEL_LINKS &&
110112
this.consoleConfig.CHANNEL_LINKS[linkId]
111113
) {
112-
return this.consoleConfig.CHANNEL_LINKS[linkId];
114+
channelLink = this.consoleConfig.CHANNEL_LINKS[linkId];
113115
}
114-
return 'javascript:void(0)';
116+
117+
if (linkParams) {
118+
channelLink = template(channelLink)(linkParams)
119+
}
120+
121+
return channelLink;
115122
};
116123

117124
public getLabel = (): ILabel => {

packages/console-utils/xconsole-context/src/rc/ChannelLink.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,8 @@ export const useChannelLink = (linkId: string, linkParams: Record<string, any>)
6767
}
6868

6969
const { consoleConfig } = React.useContext(ConsoleContext)
70-
let channelLink = consoleConfig.getChannelLink(linkId)
7170

72-
if (linkParams) {
73-
channelLink = template(channelLink)(linkParams)
74-
}
75-
return channelLink;
71+
return consoleConfig.getChannelLink(linkId, linkParams)
7672
}
7773

7874
const ChannelLink: React.FC<IChannelLinkProps> = (props: IChannelLinkProps) => {

packages/xconsole/xconsole.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"2.4.1"}
1+
{"version":"2.4.2"}

0 commit comments

Comments
 (0)