仅在safari浏览器中出现错误:
类型错误:未定义不是对象(评估“navigator.clipboard.writeText”)
我正在传递我当前的链接。可能是什么问题呢?
copyLink = e => {
e.preventDefault();
console.log(document.location.href)
navigator.clipboard
.writeText(document.location.href)
.then(() => {
this.setState({
urlIsCopied: true
});
})
.catch(e => console.error(e));
};
Run Code Online (Sandbox Code Playgroud)