event.clipboardData.setData in copy event

后端 未结 4 1629
花落未央
花落未央 2020-12-02 22:59

I have looked at many posts but could not find a clear current answer to the following two questions as it seems standards and browser support has been constantly changing.<

4条回答
  •  醉酒成梦
    2020-12-02 23:53

    For this, we can use browser API. It's worked for me

     async copyClipboard(string){    
       await navigator.clipboard.writeText(string);
       console.log("Text copied");
    }
    

提交回复
热议问题