Pass javascript function as data-* attribute and execute

前端 未结 5 694
陌清茗
陌清茗 2021-02-11 18:31

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

5条回答
  •  旧时难觅i
    2021-02-11 18:48

    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:

    
    

提交回复
热议问题