alibaba / formily

📱🚀 🧩 Cross Device & High Performance Normal Form/Dynamic(JSON Schema) Form/Form Builder -- Support React/React Native/Vue 2/Vue 3
https://formilyjs.org/
MIT License
11.43k stars 1.49k forks source link

x-linkages value:schema set type not working #680

Closed muxfe closed 4 years ago

muxfe commented 4 years ago

Help us to manage our issues by answering the following:

  1. How would you tag this issue?

    • Question
  2. Describe your issue:

    • What is the current behavior?
    • What is the expected behavior?
    • Which versions of Formily?
    • 1.0.2
    • Did this work in previous versions of Formily?

发现 formily 新增了联动协议功能,非常 nice,我之前也做过类似通过 DSL 声明来做简单联动的事情,主要有以下几个需求:

因为看到相关文档还没有完善,只是有一点疑问。

还有 1.为什么对非 x-linkages 字段也做了表达式编译,导致我原本用的 handlebars 自定义模板语法被报错😂;2.编译用 new Function 不会有风险吗,如果可以传函数,联动是否也可以直接传递 effects 处理的函数

感谢!

janryWang commented 4 years ago

能不能给个codesandbox例子呀

janryWang commented 4 years ago

安全风险问题,你可以在expressionScope里注入window,document这些为null对象,可以保证表达式内读取不到全局变量

muxfe commented 4 years ago

@janryWang

https://codesandbox.io/s/jovial-stonebraker-39j4x

构造了一个简单的例子,发现是因为我之前没写 condition 导致没有生效的。

sorry.