尝试修改BUG

This commit is contained in:
jimmy committed 2025-01-19 12:32:53 +08:00
1 parent 2693cd99cf
commit 440a4fdedf
1 file changed
+5
@@ -45,12 +45,15 @@ const previewImageInfo = reactive<{ url: string; list: string[]; idx: number }>(
) )
function previewImage (e: Event) { function previewImage (e: Event) {
console.log("11111");
const target = e.target as HTMLElement const target = e.target as HTMLElement
const currentTarget = e.currentTarget as HTMLElement const currentTarget = e.currentTarget as HTMLElement
console.log("2222");
if (target.tagName.toLowerCase() === 'img') { if (target.tagName.toLowerCase() === 'img') {
const imgs = currentTarget.querySelectorAll<HTMLImageElement>( const imgs = currentTarget.querySelectorAll<HTMLImageElement>(
'.content-container .main img', '.content-container .main img',
) )
console.log("333");
const idx = Array.from(imgs).findIndex((el) => el === target) const idx = Array.from(imgs).findIndex((el) => el === target)
const urls = Array.from(imgs).map((el) => el.src) const urls = Array.from(imgs).map((el) => el.src)
@@ -69,6 +72,7 @@ function previewImage (e: Event) {
} }
onMounted(() => { onMounted(() => {
console.log("onMounted");
if (typeof document !== 'undefined') { if (typeof document !== 'undefined') {
// 使用document的代码 // 使用document的代码
const docDomContainer = document.querySelector('#VPContent') const docDomContainer = document.querySelector('#VPContent')
@@ -77,6 +81,7 @@ onMounted(() => {
}) })
onUnmounted(() => { onUnmounted(() => {
console.log("onUnmounted");
if (typeof document !== 'undefined') { if (typeof document !== 'undefined') {
// 使用document的代码 // 使用document的代码
const docDomContainer = document.querySelector('#VPContent') const docDomContainer = document.querySelector('#VPContent')