Skip to content

Commit

Permalink
🔧 fix: 修复 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dlzmoe committed Nov 6, 2024
1 parent cec7ee5 commit 61de8c4
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions src/components/Other/Signature.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,44 @@ export default {
methods: {
init() {
$(".signature-img").each(function () {
var self = $(this);
var self1 = $(this);
// 检查是否已经处理过
if (self.data("processed")) {
return; // 如果已经处理过,跳过当前元素
}
// if (self1.data("processed")) {
// return; // 如果已经处理过,跳过当前元素
// }
var url = self.attr("src");
var img = new Image();
img.src = url;
var url1 = self1.attr("src");
var img1 = new Image();
img1.src = url1;
// 标记为已处理
self.data("processed", true);
// self1.data("processed", true);
// 图片不可访问
img.onerror = function () {
if (self.siblings(".signature-p").length < 1) {
self.after(
`<p class="signature-p">${url}(该用户签名不可访问,已自动转文字)</p>`
img1.onerror = function () {
if (self1.siblings(".signature-p").length < 1) {
self1.after(
`<p class="signature-p">${url1}(该用户签名不可访问,已自动转文字)</p>`
);
self.hide();
self1.hide();
}
};
});
},
},
created() {
// let pollinglength1 = 0;
let pollinglength2 = 0;
setInterval(() => {
this.init();
// if (pollinglength1 != $(".topic-list-body tr").length) {
// pollinglength1 = $(".topic-list-body tr").length;
// this.init();
// }
if (pollinglength2 != $(".post-stream .topic-post").length) {
pollinglength2 = $(".post-stream .topic-post").length;
this.init();
}
}, 1000);
},
};
Expand Down

0 comments on commit 61de8c4

Please sign in to comment.