diff --git "a/docs/\343\200\212ES6 \346\225\231\347\250\213\343\200\213\347\254\224\350\256\260/03.\345\217\230\351\207\217\347\232\204\350\247\243\346\236\204\350\265\213\345\200\274.md" "b/docs/\343\200\212ES6 \346\225\231\347\250\213\343\200\213\347\254\224\350\256\260/03.\345\217\230\351\207\217\347\232\204\350\247\243\346\236\204\350\265\213\345\200\274.md" index 5738eaadbc..37c3ec0b86 100644 --- "a/docs/\343\200\212ES6 \346\225\231\347\250\213\343\200\213\347\254\224\350\256\260/03.\345\217\230\351\207\217\347\232\204\350\247\243\346\236\204\350\265\213\345\200\274.md" +++ "b/docs/\343\200\212ES6 \346\225\231\347\250\213\343\200\213\347\254\224\350\256\260/03.\345\217\230\351\207\217\347\232\204\350\247\243\346\236\204\350\265\213\345\200\274.md" @@ -14,7 +14,7 @@ tags: ### 基本用法 -ES6 允许按照一定模式,从数组和对象中提取值,对变量进行赋值,这被称为解构(Destructuring)。 +ES6 允许按照一定模式,**从数组和对象中提取值,对变量进行赋值,这被称为解构**(Destructuring)。 以前,为变量赋值,只能直接指定值。 @@ -66,7 +66,7 @@ let [bar, foo] = [1]; 以上两种情况都属于解构不成功,`foo`的值都会等于`undefined`。 -另一种情况是不完全解构,即等号左边的模式,只匹配一部分的等号右边的数组。这种情况下,解构依然可以成功。 +另一种情况是**不完全解构**,即等号左边的模式,只匹配一部分的等号右边的数组。这种情况下,解构依然可以成功。 ```javascript let [x, y] = [1, 2, 3]; @@ -132,7 +132,7 @@ let [x, y = 'b'] = ['a']; // x='a', y='b' let [x, y = 'b'] = ['a', undefined]; // x='a', y='b' ``` -注意,ES6 内部使用严格相等运算符(`===`),判断一个位置是否有值。所以,只有当一个数组成员严格等于`undefined`,默认值才会生效。 +注意,ES6 内部使用严格相等运算符(`===`),判断一个位置是否有值。所以,只有 **当一个数组成员严格等于`undefined`,默认值才会生效**。 ```javascript let [x = 1] = [undefined]; diff --git a/package.json b/package.json index b287e70c27..6754d3785a 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "vuepress-plugin-one-click-copy": "^1.0.2", "vuepress-plugin-thirdparty-search": "^1.0.2", "vuepress-plugin-zooming": "^1.1.7", - "vuepress-theme-vdoing": "^1.3.4", + "vuepress-theme-vdoing": "^1.3.5", "yamljs": "^0.3.0" }, "dependencies": { diff --git a/theme-vdoing/layouts/Layout.vue b/theme-vdoing/layouts/Layout.vue index 64dc04cc6f..4af3bff5bc 100644 --- a/theme-vdoing/layouts/Layout.vue +++ b/theme-vdoing/layouts/Layout.vue @@ -186,7 +186,17 @@ export default { this.setBodyClass() }, mounted () { - this.showSidebar = true // 解决移动端初始化页面时侧边栏闪现的问题 + + // 初始化页面时链接锚点无法跳转到指定id的解决方案 + const hash = document.location.hash; + if (hash.length > 1) { + const id = decodeURIComponent(hash.substring(1)) + const element = document.getElementById(id) + if (element) element.scrollIntoView() + } + + // 解决移动端初始化页面时侧边栏闪现的问题 + this.showSidebar = true this.$router.afterEach(() => { this.isSidebarOpenOfclientWidth() }) diff --git a/theme-vdoing/package.json b/theme-vdoing/package.json index ab7cfae838..7acf68fe64 100644 --- a/theme-vdoing/package.json +++ b/theme-vdoing/package.json @@ -1,6 +1,6 @@ { "name": "vuepress-theme-vdoing", - "version": "1.3.4", + "version": "1.3.5", "description": "Vdoing theme for VuePress. 一个基于VuePress的知识管理兼博客主题。", "author": { "name": "gaoyi(Evan) Xu" diff --git a/theme-vdoing/styles/code.styl b/theme-vdoing/styles/code.styl index a7add7b7cb..e65907be73 100644 --- a/theme-vdoing/styles/code.styl +++ b/theme-vdoing/styles/code.styl @@ -42,7 +42,7 @@ div[class*="language-"] width 100% line-height 1.4 .highlighted - background-color rgba(0, 0, 0, 66%) + background-color rgba(0, 0, 0, 30%) pre, pre[class*="language-"] background transparent position relative @@ -70,7 +70,7 @@ div[class*="language-"] display block width $lineNumbersWrapperWidth height 100% - background-color rgba(0, 0, 0, 66%) + background-color rgba(0, 0, 0, 30%) pre padding-left $lineNumbersWrapperWidth + 1 rem vertical-align middle