- 这篇博客先开个头,
对于js的基础,还是需要多加学习,
学习借助别人的力量去,大佬们写的东西需要去吸收
对象的解构
const { log } = console; //console.log
log('hello')
/*******************/
let test={ foo: 'aaa', bar: 'bbb' }
let { foo, bar } = test;
foo
bar
使用变量名直接作为函数名
只能说ES6这是一个神奇的东西(fucking amazing)
export const SOME_MUTATION = 'SOME_MUTATION'
// store.js
import Vuex from 'vuex'
import { SOME_MUTATION } from './mutation-types'
const store = new Vuex.Store({
state: { ... },
mutations: {
// 我们可以使用 ES2015 风格的计算属性命名功能来使用一个常量作为函数名
//注: ES2015 即是ES6
[SOME_MUTATION] (state) {
// mutate state
}
}
})