js复制copy

发布于:2023-05-04 ⋅ 阅读:(510) ⋅ 点赞:(0)
     const el = document.createElement('input')
    el.setAttribute('value', '要复制的类容')
    // el.style.display = 'none'
    el.setAttribute('stype','display:none')
    document.body.appendChild(el)
    el.select()
    const flag = document.execCommand('copy')
    document.body.removeChild(el)

微信公众号

今日签到

点亮在社区的每一天
去签到