Pass javascript function as data-* attribute and execute

前端 未结 4 808
甜味超标
甜味超标 2021-02-11 18:21

We know such syntaxes as below, when defining a value for onClick attribute:

4条回答
  •  眼角桃花
    2021-02-11 18:38

    If you really wanted to pass functions (with or without parameters) from one thing to another without binding them as events you could do it this way (I started from @Taplar's answer)

    
    
    
    
    
    
    

    Then you could access them in your other component as:

    
    

提交回复
热议问题