Skip to content

Commit 906daaa

Browse files
committed
fix: improve custom input handling in List.vue
1 parent 6b732c2 commit 906daaa

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

  • packages/dag/src/components/form/field-inference

packages/dag/src/components/form/field-inference/List.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -745,10 +745,11 @@ export default {
745745
handleChangeCustomInput() {
746746
const { customInputData } = this.currentData
747747
this.currentData.newDataType = this.customInputDataValue
748-
.replace('[', '')
749-
.replace(']', '')
750-
.replace(/\$[^,]*\b/g, function (val) {
751-
return '' + customInputData[val.replace(/^\$/, '')]?.value || val
748+
.replace(/\[(.*?)\]/g, '$1') // 去掉所有的方括号,保留内容
749+
.replace(/\$\w+/g, match => {
750+
// 匹配所有 $ 开头的变量
751+
const key = match.slice(1) // 去掉 $ 前缀
752+
return customInputData[key]?.value || match
752753
})
753754
}
754755
}

0 commit comments

Comments
 (0)