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

[Bug] for 循环中 range 的参数无法用变量代替 #434

Closed
4 tasks done
NineHolic opened this issue Jun 30, 2023 · 1 comment
Closed
4 tasks done

[Bug] for 循环中 range 的参数无法用变量代替 #434

NineHolic opened this issue Jun 30, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@NineHolic
Copy link

Verify steps

  • Tracker 我已经在 Issue Tracker 中找过我要提出的问题
  • Latest 我已经使用 最新源码 测试过,问题依旧存在
  • Core 这是 QD 框架存在的问题,并非我所使用的 QD 早期版本(如 20210628及之前版号 等)或模板的特定问题
  • Meaningful 我提交的不是无意义的 催促更新或修复 请求

QD Version

20230626

Bug on OS

Linux

Bug on Platform

Code Build/Linux 64位

To Reproduce

如 range(1,5),使用 range(1,num) 将参数用变量代替后没有进行循环

Describe the Bug

使用 range(1,num) 将参数用变量代替后没有进行循环

QD config

No response

QD log

Expected behavior

for 循环中 range 的参数可以用变量代替

Screenshots

No response

@NineHolic NineHolic added the bug Something isn't working label Jun 30, 2023
@a76yyyy
Copy link
Contributor

a76yyyy commented Jul 15, 2023

@NineHolic 请使用如下格式, 即在 range 中变量必须是整型

{% for i in range(1,int(num)) %}

在QD框架中, 所有使用正则表达式获取到的变量均为 str 字符串(除 /g 获取到的变量是 list 列表)类型, 因此你需要进行类型转换

如果还有问题, 请 reopen 这个 issue

@a76yyyy a76yyyy closed this as completed Jul 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants