Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用内置表达式如SPLIT等,无法正确的处理变量中的双反斜线\\ #9933

Closed
061225 opened this issue Mar 29, 2024 · 1 comment · Fixed by #9943
Closed

使用内置表达式如SPLIT等,无法正确的处理变量中的双反斜线\\ #9933

061225 opened this issue Mar 29, 2024 · 1 comment · Fixed by #9943
Assignees
Labels
awaiting-release bug Something isn't working

Comments

@061225
Copy link

061225 commented Mar 29, 2024

实现场景:

页面的一个变量存储了windows路径,
使用SPLIT、REPLACE、CONTAINS等内置表达式均无法处理双反斜线 "\",
使用表达式${xx|split:\},可以处理,
因为目前需要使用REPLACE、CONTAINS等方法,想问下该怎么处理(JS可实现,但不便于后续维护)

存在的问题:

页面定义变量{"C_PATH":"S:\CACHE"},
使用 SPLIT(C_PATH, '\'),返回的是 ["S:\CACHE"],不正确
使用 ${C_PATH|split:\},返回的是 ["S:","CACHE"],正确

当前方案:

{
  "type": "page",
  "title": "测试",
  "body": [
    {
      "type": "input-text",
      "label": "【正确】数据映射split处理字符串",
      "name": "t1",
      "id": "u:ab6edffd75df",
      "value": "${C_PATH|split:\\\\}"
    },
    {
      "type": "input-text",
      "label": "【错误】表达式SPLIT处理字符串",
      "name": "t2",
      "id": "u:d5f70deb9cb8",
      "value": "${SPLIT(C_PATH,'\\\\')}"
    }
  ],
  "id": "u:99f3d9bbbac0",
  "asideResizor": false,
  "pullRefresh": {
    "disabled": true
  },
  "regions": [
    "body"
  ],
  "data": {
    "C_PATH": "S:\\CACHE"
  }
}
@061225
Copy link
Author

061225 commented Mar 29, 2024

补充:版本是 6.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-release bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants