javascript - 禁用 html 样式的复制
问题描述
header.value
是否可以在此“如果”中禁用副本?(如果是,如何?)
<div
class="value"
style="{{header.name === 'abc' ? 'color: transparent; text-shadow: 0 0 5px black;' : ''}}"
>
{{ header.value }}
</div>
谢谢!
解决方案
您可以在 css 中使用它:
.value {
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
这将阻止用户选择文本并复制它。示例:https ://codesandbox.io/s/small-sea-rseff?file=/index.html
推荐阅读
- javascript - 返回 PDF 文件而不是二进制数据 Zapier Developer 平台
- flask - 带有蓝图和命名空间的 flask-restplus 嵌套命名空间
- c - 使用文件指针时如何处理分段错误?
- go - 安装 go 工具的 go 模块
- python - 函数参数的可变性
- c - 自由双指针结构
- c# - Powerpoint中形状的部分下划线检查不起作用?
- lotus-notes - 使用 IBM lotus notes c api 工具包的 MIMEGetEntityData() 方法无法正确获取 MIME 数据
- git - 通过 SSH 密钥使用多个 Github 帐户
- google-maps - 如果我们再次返回标签,则标签中的谷歌地图删除搜索栏