This commit is contained in:
xugaoyi 2020-07-04 16:41:01 +08:00
parent a77a24d119
commit 450f6215d3
5 changed files with 18 additions and 8 deletions

View File

@ -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];

View File

@ -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": {

View File

@ -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()
})

View File

@ -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"

View File

@ -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