require('xx').default
加default的原因,鏈接
import require區(qū)別
import靜態(tài)編譯,require不是。
const url = 'xxxx' + 'yyyy'
import url,報錯。require(url)不報錯。動態(tài)加載使用require。
process.env.NODE_ENV
process是全局變量,提供node的有關(guān)信息,env是它的屬性。
輸入node,再輸入process.env即可打印。
NODE_ENV不是對象原有屬性,是添加上去的環(huán)境變量。

dayjs
格式時間的插件,2kb,支持所有的瀏覽器
dayjs文檔


d2admin頁面發(fā)請求過程





mock攔截請求,模擬數(shù)據(jù)的過程
actionFn({commit, dispatch}, {xx: xx, yy: yy} = {}, {root: true})參數(shù)
第二個參數(shù)是為了初始化值為空,并且運行之初不報錯
mixins作用

hasOwnProperty
判斷對象有沒有這個屬性,返回布爾值
const object1 = new Object();
object1.property1 = 42;
console.log(object1.hasOwnProperty('property1'));
// expected output: true
console.log(object1.hasOwnProperty('toString'));
// expected output: false
在不繼承的情況下迭代
var o = {
a: 'aa',
b: 'bb',
c: {
c1: '11',
c2: '22'
}
}
let newO = {}
for (const n in o) {
if(o.hasOwnProperty(n)) {
newO[n] = o[n]
}
}
console.log(newO)
lowdb
lowdbgithub地址
Small JSON database for Node, Electron and the browser
數(shù)據(jù)保存在db.json或者LocalStorage里的
