diff --git a/assets/css/style.css b/assets/css/style.css index cf5a77b..7d3d6a6 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -7,6 +7,9 @@ html, body { overflow: hidden; font-size: 14px; } +:root{ + --resizable-content-width: 300px; /* 默认值,会被 JS 覆盖 */ +} a { /*去除默认下划线*/ text-decoration: none; @@ -54,4 +57,4 @@ a { /*手指*/ .point{ cursor: pointer; -} \ No newline at end of file +} diff --git a/assets/icon/star-blogIconFont/iconfont.css b/assets/icon/star-blogIconFont/iconfont.css index 8b49758..874aab5 100644 --- a/assets/icon/star-blogIconFont/iconfont.css +++ b/assets/icon/star-blogIconFont/iconfont.css @@ -1,12 +1,12 @@ @font-face { - font-family: "star-blog"; /* Project id 4905744 */ + font-family: "star-blogIconFont"; /* Project id 4905744 */ src: url('iconfont.woff2?t=1745569316996') format('woff2'), url('iconfont.woff?t=1745569316996') format('woff'), url('iconfont.ttf?t=1745569316996') format('truetype'); } .star-blogIconFont { - font-family: "star-blog" !important; + font-family: "star-blogIconFont" !important; font-size: 16px; font-style: normal; -webkit-font-smoothing: antialiased; diff --git a/components/Home/Blog/Menu.vue b/components/Home/Blog/Menu.vue new file mode 100644 index 0000000..f3dd01d --- /dev/null +++ b/components/Home/Blog/Menu.vue @@ -0,0 +1,272 @@ + + + + + diff --git a/components/ResizeContent.vue b/components/ResizeContent.vue index 9d3c351..c893452 100644 --- a/components/ResizeContent.vue +++ b/components/ResizeContent.vue @@ -6,7 +6,7 @@ import { ref, onMounted, onBeforeUnmount } from 'vue' // 响应式数据 // ===================== const resizableElement = ref(null) // 元素引用 -const width = ref(240) // 显示的宽度值 +const width = ref(0) // 显示的宽度值 const isDragging = ref(false) // 拖拽状态标识 const startX = ref(0) // 拖拽起始X坐标 const startWidth = ref(0) // 拖拽起始宽度 @@ -45,12 +45,16 @@ const handleDrag = (e) => { const clampedWidth = Math.max(100, newWidth) // 优化:直接操作 CSS 变量减少响应式更新 - resizableElement.value.style.setProperty('--width', `${clampedWidth}px`) + setRootPropertyValue(clampedWidth) // 低频更新响应式数据(用于显示数值) width.value = clampedWidth }) } +function setRootPropertyValue(value){ + const root = document.documentElement; // 获取根元素 + root.style.setProperty('--resizable-content-width', `${value}px`) +} const stopDrag = () => { isDragging.value = false @@ -67,7 +71,10 @@ const stopDrag = () => { // ===================== onMounted(() => { // 初始化 CSS 变量 - resizableElement.value.style.setProperty('--width', `${width.value}px`) + // 获取CSS变量的值 + const root = document.documentElement; // 获取根元素 + const resizableContentWidth = getComputedStyle(root).getPropertyValue('--resizable-content-width').trim(); + width.value = Number(resizableContentWidth.split('px')[0]) }) onBeforeUnmount(() => { @@ -77,41 +84,41 @@ onBeforeUnmount(() => { \ No newline at end of file +