Vuex
开始
1 | import Vue from "vue"; |
- 通过操作
mutation来改变state:- 通过
store.state获取状态,store.commit('increment')触发状态变更
- 通过
Translates a function from callable as f(a, b, c) into callable as f(a)(b)(c).
1 | log(new Date(), "DEBUG", "some debug"); // log(a, b, c) |
logNow is log with fixed first argument, in other words “partially applied function” or “partial” for short.let proxy = new Proxy(target, handler)
target: is an object to wrap, can be anything, including functions.handler: proxy configuration, an object with “traps”, methods that intercept operations. – e.g. get trap for reading a property of target, set trap for writing a property into target…proxy are forwarded to target.proxy.test= sets the value on targetproxy.test returns the value from targetfor(key in proxy) returns values from target<script type="module">use strict and Each module has its own module-level scope. Only export what they want to be accessible from outside and import what they need.import.meta: contains the information about the current module.