基本的做法是在lwc里先
renderedCallback() { if (this.isPrevious) { this.dispatchEvent(new FlowNavigationBackEvent()); } else { //处理字符串 this.isPrevious = true; this.dispatchEvent(new FlowNavigationNextEvent()); }
另外在放lwc的那个Screen里,在lwc的选项里勾选Advanced - Refresh inputs to incorporate changes elsewhere in the flow(否则回退时isPrevious依然为false)。这样就可以了。
不过,虽然问题解决了,但总感觉有点别扭。看来,这次得到的宝贵教训是以后如果不需要界面,只需要功能的需求,还是尽量用apex好。
Salesforce: lwc处理Flow的Navigation事件
原文:https://www.cnblogs.com/badnumber/p/14873562.html