修复parseVarInput在处理特殊字符时的BUG

This commit is contained in:
fofolee
2025-01-08 16:40:18 +08:00
parent 8003497e71
commit ebbc7b7661
2 changed files with 8 additions and 8 deletions

View File

@@ -37,5 +37,10 @@ export const newEmptyVarInputVal = (type = "str") => {
* @returns {string} 处理后的字符串
*/
export const stringifyVarInputVal = (argv) => {
return argv.isString ? `"${argv.value}"` : argv.value;
if (!argv.isString) return argv.value;
try {
return JSON.stringify(argv.value);
} catch (e) {
return `"${argv.value}"`;
}
};