- 父组件html中定义ongoback方法
<c-myapp-insert myapp-token={myappToken} myapp-user={searchKey}
disp-mode={dispMode} info-id={infoId}
ongoback={saveBackList}></c-pisp-insert>
- 子组件Js中定义事件(goback)
const gobackEvent = new CustomEvent('goback');
this.dispatchEvent(gobackEvent);
这样,当子组件dispatchEvent()执行后,就能被父组件的ongoback事件监听到,执行父组件的saveBackList方法了。