Record vue custom instruction to achieve display search history, click to hide in other regions

// const clickoutside = { 
//    the bind (EL, Binding,) { 
//      function DocumentHandler (E) { 
//    // click here determined whether the element itself is, per se, is returned 
//        IF (el.contains ( e.target)) { 
//          return to false; 
//    } 
//    // instruction determines whether the binding function 
//        IF (binding.expression) { 
//    // If the function is called a binding function, this at binding.value method is handleClose 
//          binding.value (E); 
//        } 
//   } 
//   // bind to the current element has Private variables can be easily released in the event listener unbind 
//      EL .__ vueClickOutside__ = DocumentHandler ; 
//     document.addEventListener('click', documentHandler);
//   },
//   unbind() {
//  // 解除事件监听
//     document.removeEventListener('click', el.__vueClickOutside__);
//     delete el.__vueClickOutside__;
//   },
// };
contains (), only to judge DOM, can not be used like Java!

Guess you like

Origin www.cnblogs.com/xiaxuening/p/10974787.html