haizlin/fe-interview

[js] 第658天 写一个方法实现选中复制的功能

Opened this issue · 1 comments

第658天 写一个方法实现选中复制的功能

3+1官网

我也要出题

document.onmousedown=function(){
//console.log('xxxx')
document.onmousemove=function(){
//console.log(document.getSelection().toString());
navigator.clipboard.writeText(document.getSelection().toString())

}

}
document.onmouseup=function(){
document.onmousemove=null
}