链接复制功能
This commit is contained in:
+15
-1
@@ -71,7 +71,7 @@
|
||||
<td>${item.update_time}</td>
|
||||
<td>
|
||||
<i class="layui-icon layui-icon-edit" style="font-size: 15px; color: #1E9FFF;cursor: pointer;" onclick="window.open('detail?id=${item.id}')">编辑</i>
|
||||
<i class="layui-icon layui-icon-share" style="font-size: 15px; color: #1E9FFF;cursor: pointer;margin-left: 10px;">复制分享</i>
|
||||
<i class="layui-icon layui-icon-share" style="font-size: 15px; color: #1E9FFF;cursor: pointer;margin-left: 10px;" onclick="copy_url(${item.id})">复制分享</i>
|
||||
<i class="layui-icon layui-icon-delete" style="font-size: 15px; color: #1E9FFF;cursor: pointer;margin-left: 10px;" onclick="delmind(${item.id})">删除</i>
|
||||
</td>
|
||||
</tr>`
|
||||
@@ -251,6 +251,20 @@
|
||||
function delmind(id) {
|
||||
view.del_mind(id)
|
||||
}
|
||||
|
||||
// 复制链接
|
||||
function copy_url(id) {
|
||||
let href = location.href + `detail?id=${id}`;
|
||||
console.log(href)
|
||||
navigator.clipboard.writeText(href)
|
||||
.then(() => {
|
||||
// Success!
|
||||
layer.msg('复制成功')
|
||||
})
|
||||
.catch(err => {
|
||||
console.log('Something went wrong', err);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user