效果展示
资源引用
`
`
代码
/* 复制提醒 */
`document.addEventListener("copy",function(e){
new Vue({data:function(){
this.$notify({
title:"嘿!复制成功",
message:"若要转载请务必保留原文链接!爱你呦~",
position: 'bottom-right',
offset: 50,
showClose: false,
type:"success"
});
return{visible:false}
}
})
})
`
禁止使用右键和提醒 (在任意引用全局 JS 的文件内添加)
`/ 禁用右键菜单并提醒 /
document.oncontextmenu = function () {
new Vue({data:function(){
this.$notify({
title:"嘿!没有右键菜单",
message:"复制请用键盘快捷键",
position: 'bottom-right',
offset: 50,
showClose: false,
type:"warning"
});
return{visible:false}
}
})
return false;
}
`
禁止使用 f12 并且提醒 (在任意引用全局 JS 的文件内添加)
`/ 禁用 F12 按键并提醒 /
document.onkeydown = function () {if (window.event && window.event.keyCode == 123) {
event.keyCode = 0;
event.returnValue = false;
new Vue({data:function(){
this.$notify({
title:"嘿!别瞎按",
message:"坏孩子!",
position: 'bottom-right',
offset: 50,
showClose: false,
type:"error"
});
return{visible:false}
}
})
return false;
}
};
`