尝试修改BUG尝试6
This commit is contained in:
1 parent
a45712adc5
commit
73020a33b2
12 files changed
+2936
-5104
No files matched your search
@@ -26,7 +26,6 @@ const globalConfig = ref<typeof zhConfig >(zhConfig)
|
||||
watch(
|
||||
() => route.path,
|
||||
() => {
|
||||
console.log("监视属性");
|
||||
globalConfig.value = zhConfig
|
||||
},
|
||||
{
|
||||
@@ -45,59 +44,45 @@ const previewImageInfo = reactive<{ url: string; list: string[]; idx: number }>(
|
||||
)
|
||||
|
||||
function previewImage (e: Event) {
|
||||
show.value = true
|
||||
console.log("11111");
|
||||
const target = e.target as HTMLElement
|
||||
const currentTarget = e.currentTarget as HTMLElement
|
||||
console.log("2222");
|
||||
if (target.tagName.toLowerCase() === 'img') {
|
||||
const imgs = currentTarget.querySelectorAll<HTMLImageElement>(
|
||||
'.content-container .main img',
|
||||
)
|
||||
const idx = Array.from(imgs).findIndex((el) => el === target)
|
||||
console.log(idx,"333");
|
||||
const urls = Array.from(imgs).map((el) => el.src)
|
||||
|
||||
console.log(urls,"8888");
|
||||
const url = target.getAttribute('src')
|
||||
previewImageInfo.url = url!
|
||||
previewImageInfo.list = urls
|
||||
previewImageInfo.idx = idx
|
||||
console.log(url,"666");
|
||||
|
||||
// 兼容点击 main 之外的图片
|
||||
if (idx === -1 && url) {
|
||||
console.log("777");
|
||||
previewImageInfo.list.push(url)
|
||||
previewImageInfo.idx = previewImageInfo.list.length - 1
|
||||
}
|
||||
console.log("555");
|
||||
show.value = true
|
||||
console.log("444");
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
console.log("onMounted");
|
||||
if (typeof document !== 'undefined') {
|
||||
console.log("typeof document !== 'undefined'");
|
||||
// 使用document的代码
|
||||
const docDomContainer = document.querySelector('#VPContent')
|
||||
console.log("docDomContainer");
|
||||
docDomContainer?.addEventListener('click', previewImage)
|
||||
console.log("docDomContainer?.addEventListener");
|
||||
}
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
console.log("onUnmounted");
|
||||
if (typeof document !== 'undefined') {
|
||||
// 使用document的代码
|
||||
const docDomContainer = document.querySelector('#VPContent')
|
||||
docDomContainer?.removeEventListener('click', previewImage)
|
||||
}
|
||||
})
|
||||
console.log("0000000000");
|
||||
|
||||
</script>
|
||||
<style>
|
||||
/* 不提供下载功能,隐藏下载按钮,tdesign 下载有问题 */
|
||||
|
||||
@@ -5,7 +5,6 @@ import autoSidebar from '../../autoSidebar'
|
||||
|
||||
const router = useRouter()
|
||||
const prefix = '/notes/'
|
||||
// /notes/Python基础/01python数据模型
|
||||
let sideBarElement = autoSidebar[prefix]
|
||||
let sideBarElementElement = sideBarElement[0]
|
||||
const firstItemLink = sideBarElementElement.items[0].link
|
||||
|
||||
@@ -10,14 +10,14 @@ import ImageViewer from './components/ImageViewer.vue'
|
||||
import GoBack from './components/GoBack.vue'
|
||||
|
||||
export default {
|
||||
...Theme,
|
||||
Layout: () => {
|
||||
return h(Theme.Layout, null, {
|
||||
// https://vitepress.dev/guide/extending-default-theme#layout-slots
|
||||
'doc-after': () => h(Comment),
|
||||
'doc-bottom': () => h(ImageViewer),
|
||||
'aside-top': () => h(GoBack),
|
||||
})
|
||||
},
|
||||
...Theme,
|
||||
Layout: () => {
|
||||
return h(Theme.Layout, null, {
|
||||
// https://vitepress.dev/guide/extending-default-theme#layout-slots
|
||||
'doc-after': () => h(Comment),
|
||||
'doc-bottom': () => h(ImageViewer),
|
||||
'aside-top': () => h(GoBack),
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
@@ -3,13 +3,11 @@
|
||||
font-family: "FiraCode";
|
||||
src: url("/assets/fonts/FiraCode-VF.woff2");
|
||||
}
|
||||
|
||||
/** 正文字体 */
|
||||
@font-face {
|
||||
font-family: "SourceHanSerifCN";
|
||||
src: local("SourceHanSerifCN"), url("/assets/fonts/SourceHanSerifCN-VF.woff2");
|
||||
}
|
||||
|
||||
/** logo 字体 */
|
||||
@font-face {
|
||||
font-family: "Niconne";
|
||||
@@ -31,7 +29,7 @@
|
||||
--vp-c-blue-2: #0749ff;
|
||||
--vp-c-blue-3: #7494ec;
|
||||
--vp-c-blue-soft: rgba(110, 156, 190, 0.14);
|
||||
|
||||
|
||||
--vp-c-yellow-1: #aa9100;
|
||||
--vp-c-yellow-2: #d5b811;
|
||||
--vp-c-yellow-3: #ecce23;
|
||||
@@ -73,9 +71,9 @@
|
||||
--td-brand-color-active: var(--vp-c-brand-2) !important;
|
||||
/* 字体 family token */
|
||||
--td-font-family: SourceHanSerifCN, PingFang SC, Microsoft YaHei,
|
||||
Arial Regular;
|
||||
Arial Regular;
|
||||
--td-font-family-medium: SourceHanSerifCN, PingFang SC, Microsoft YaHei,
|
||||
Arial Medium;
|
||||
Arial Medium;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,13 +140,12 @@ main > div > div > pre > code {
|
||||
.VPNavBar {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.VPNav .content .content-body {
|
||||
backdrop-filter: blur(36px);
|
||||
background-color: linear-gradient(
|
||||
to bottom,
|
||||
rgba(var(--vp-nav-bg-color), 0.98),
|
||||
rgba(var(--vp-nav-bg-color), 0.6)
|
||||
to bottom,
|
||||
rgba(var(--vp-nav-bg-color), 0.98),
|
||||
rgba(var(--vp-nav-bg-color), 0.6)
|
||||
) !important;
|
||||
}
|
||||
|
||||
@@ -156,9 +153,9 @@ main > div > div > pre > code {
|
||||
.VPLocalNav .container {
|
||||
backdrop-filter: blur(36px);
|
||||
background-color: linear-gradient(
|
||||
to bottom,
|
||||
rgba(var(--vp-nav-bg-color), 0.6),
|
||||
rgba(var(--vp-nav-bg-color), 0.4)
|
||||
to bottom,
|
||||
rgba(var(--vp-nav-bg-color), 0.6),
|
||||
rgba(var(--vp-nav-bg-color), 0.4)
|
||||
) !important;
|
||||
}
|
||||
|
||||
@@ -187,4 +184,4 @@ main > div > div > pre > code {
|
||||
* {
|
||||
/* scrollbar-color: rgba(0, 0, 0, 0.12) transparent; */
|
||||
scrollbar-width: thin;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user