diff --git a/src/components/composer/common/VariableInput.vue b/src/components/composer/common/VariableInput.vue index d1617d1..a98cfed 100644 --- a/src/components/composer/common/VariableInput.vue +++ b/src/components/composer/common/VariableInput.vue @@ -293,16 +293,11 @@ export default defineComponent({ const value = this.getItemValue(option); this.$emit("update:modelValue", newVarInputVal("str", value)); }, - escapePath(paths) { - if (!paths) return null; - if (typeof paths === "string") return paths.replace(/\\/g, "\\\\"); - return paths.map((path) => path.replace(/\\/g, "\\\\")); - }, handleFileOpen(dialog) { let { type, options } = window.lodashM.cloneDeep(dialog); if (!type) type = "open"; if (type === "open") { - const files = this.escapePath(utools.showOpenDialog(options)); + const files = utools.showOpenDialog(options); if (!files) return; if (files.length > 1) { this.$emit("update:modelValue", newVarInputVal("var", files)); @@ -310,7 +305,7 @@ export default defineComponent({ this.$emit("update:modelValue", newVarInputVal("str", files[0])); } } else { - const file = this.escapePath(utools.showSaveDialog(options)); + const file = utools.showSaveDialog(options); if (!file) return; this.$emit("update:modelValue", newVarInputVal("str", file)); } diff --git a/src/js/composer/varInputValManager.js b/src/js/composer/varInputValManager.js index f07614f..698589a 100644 --- a/src/js/composer/varInputValManager.js +++ b/src/js/composer/varInputValManager.js @@ -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}"`; + } };