fix: 处理策略config双层转义问题,前端自动解析两层JSON
This commit is contained in:
parent
d873651c16
commit
8c16358c56
@ -197,7 +197,19 @@ const fetchStrategies = async () => {
|
|||||||
name: item.name,
|
name: item.name,
|
||||||
desc: item.description,
|
desc: item.description,
|
||||||
type: item.type,
|
type: item.type,
|
||||||
parameters: item.config ? JSON.parse(item.config) : {},
|
parameters: item.config ? (() => {
|
||||||
|
try {
|
||||||
|
let config = JSON.parse(item.config);
|
||||||
|
// 如果解析后还是字符串,再解析一次(处理双层转义)
|
||||||
|
if (typeof config === 'string') {
|
||||||
|
config = JSON.parse(config);
|
||||||
|
}
|
||||||
|
return config;
|
||||||
|
} catch (e) {
|
||||||
|
console.error('解析策略配置失败:', e);
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
})(),
|
||||||
color: '#10B981'
|
color: '#10B981'
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user