Click event passed by component

This method is suitable for click events transmitted between components and components and between components and pages;
(show and hide effects have been switched as an example)

1. Write the bullet frame component in the parent component;

2. In the parent component: the
pop-up component passes variables to determine whether to show or hide; the
parent component
adds a click event to switch display and hide; the pop-up component bind:toPopHidden='toPop' toPop writes the click event

3. In the bullet box component:
wx:if='{ {}}' Judge to show or hide
plus click event

  var myEventDetail = { } // detail对象,提供给事件监听函数
  var myEventOption = {} // 触发事件的选项
  this.triggerEvent(' toPopHidden ', myEventDetail, myEventOption)

Guess you like

Origin blog.csdn.net/jiaodeqiangs/article/details/95319050