How to trigger data linkage through JS
1. Usage scenarios
In the process of configuring data linkage, we usually encounter the situation that the data linkage configuration does not take effect. One of the reasons is that after we use JS to assign A value to component A, this component A is used as the condition of data linkage to trigger data linkage and link out data B, so the data linkage does not take effect. So how can we configure it?
2. Video Display
此处为语雀视频卡片,点击链接查看:0707-通过js模拟手动更新值触发数据联动.mov
3. Procedure
3.1 configure component a, component A, and component B to bind an action onChange event to component a. This event is triggered when the value of component a changes.
3.2 assign A value to component A through JS, and configure data linkage conditional on A in component B
As shown in the following figure:
3.3 In the action event configured by component a, the linkage update effect generated after manually updating the value is simulated by code.
The reference code is as follows:
export function onChange({ value }) {
console.log('onChange', value);
this.$('textField_kqs21dbs').getProps().onChange({ value: "XXX" });
/*通过代码模拟手动更新值后产生的联动更新效果,唯一标识符为组件A的唯一标识符,XXX为给组件A赋的值*/
}
-------------------- Get the latest information YIDA, welcome to follow US--------------------
This doc is generated using machine translation. Any discrepancies or differences created in the translation are not binding and have no legal effect for compliance or enforcement purposes.
本文档对您是否有帮助?