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

期望支持自定义公式,类似自定义过滤器 #10875

Open
thinkingc opened this issue Sep 5, 2024 · 2 comments
Open

期望支持自定义公式,类似自定义过滤器 #10875

thinkingc opened this issue Sep 5, 2024 · 2 comments
Assignees
Labels
doc optimizing document enhancement New feature or request

Comments

@thinkingc
Copy link
Contributor

是否关联于某个问题吗:

过滤器已经不推荐使用,推荐使用表达式,但没有办法自定义公式,还是要自定义过滤器实现。

https://baidu.github.io/amis/zh-CN/docs/concepts/expression#%E5%85%AC%E5%BC%8F

预期的解决方案:

期望支持自定义公式。比如

import { registerFunction } from 'amis'

registerFunction('CUSTOM_SUM', (a, b, fn) => { return  fn(a) + fn(b) }

{
tpl: "CUSTOM_SUM(1,2, item => item * -1)"
}

其他可接受方案:

任何附加信息:

@thinkingc thinkingc added the enhancement New feature or request label Sep 5, 2024
Copy link

github-actions bot commented Sep 5, 2024

👍 Thanks for this!
🏷 I have applied any labels matching special text in your issue.

Please review the labels and make any necessary changes.

@github-actions github-actions bot added the doc optimizing document label Sep 5, 2024
@allenve allenve self-assigned this Sep 27, 2024
@allenve
Copy link
Collaborator

allenve commented Sep 27, 2024

registerFunction,

在 amis-formula 中
import { registerFunction } from 'amis-formula'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc optimizing document enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants