Files
heros/doc/mvvm/VMEvent.md

22 lines
1.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## VM Event
### 介绍
VM组件事件监听watchPath 路径 数值的变动情况调用回调函数。可以同时监听复数路径的值。适合需要自己处理数值变化行为的场合。比如获得1金币想让数字闪烁一下有了VMEvent ,你就不用手动去让数字闪烁了。可以在编辑器中直接设置回调,来触发别的组件的函数。
### 编辑器属性
- `Template Mode` - 多路径模板模式,开启后可以监听多路径
- `Watch Path ` - 绑定数值监听路径
- `Watch PathArr` - 绑定数值监听的路径数组 (多路径模板模式开启后出现)
- `Component Name` - 绑定组件的名字 (会根据脚本配置自动识别)
- `Component Property` - 绑定组件上需要监听的属性 (会根据脚本配置自动识别)
- `Trigger Once` - 事件通知只传递一次,然后自动 disabled 该组件
- `Filter Mode` - 根据条件过滤通知事件,比如 当值>=30 才会通知事件去调用 Change Events
- `Change Events` - 值路径改变事件,和按钮回调事件类似 在编辑器里绑定对应要执行的节点函数