效果展示
![图片[1]-复制小弹框-资源社区](https://www.vrhi.cn/wp-content/uploads/2024/11/20241129110134997-17328492942024112903013436.webp)
代码
Vue代码
function vue_style(){?>
<script src="vue.min.js文件路径"></script>
<script src="index.js文件路径"></script>
<link rel="stylesheet" href="index.css文件路径">
<?php }add_action('wp_head', 'vue_style');
复制小弹框代码
document.addEventListener("copy", function (e) {
const selection = window.getSelection ? window.getSelection() : document.selection.createRange().text;
const target = e.target;
if (target.closest('.article-content') && selection.toString() !== '') {
new Vue({
data: function () {
this.$notify({
title: "叮!复制成功",
message: "若要转载请务必保留原文链接!谢谢~",
position: 'bottom-right',
offset: 50,
showClose: true,
type: "success"
});
return { visible: false };
}
});
} else if (selection.toString() === '') {
new Vue({
data: function () {
this.$notify({
title: "咦?复制失败",
message: "啊噢...你没还没选择内容呢!",
position: 'bottom-right',
offset: 50,
showClose: true,
type: "success"
});
return { visible: false };
}
});
}
});
使用方法
首先上传vue代码文件到一个可以访问地方,然后将Vue代码放入到zibll文件夹下function.php
文件中或者新建一个func.php
放入其中并进行修改,接着将复制小弹框代码放置在Zibll主题设置>全局&功能>自定义代码>自定义JS
样式中
© 版权声明
本站收集的资源仅供内部学习研究软件设计思想和原理使用,学习研究后请自觉删除,请勿传播,因未及时删除所造成的任何后果责任自负。
如果用于其他用途,请购买正版支持作者,谢谢!若您认为「WWW.VRHI.CN」发布的内容若侵犯到您的权益,请联系站长邮箱:system@mail.vrhi.cn 进行删除处理。
本站资源大多存储在云盘,如发现链接失效,请联系我们,我们会第一时间更新。THE END
暂无评论内容