import dayjs from 'dayjs' import quarterOfYear from 'dayjs/plugin/quarterOfYear' import customParseFormat from 'dayjs/plugin/customParseFormat' import advancedFormat from 'dayjs/plugin/advancedFormat' let hasInited = false; export function extendDayjsPlugins() { if (hasInited) { return } hasInited = true // 这个具有全局副作用... // 其实我也不知道合不合适... 先加了观察观察 (观察是否会 "多加到全局的 dayjs" 中, 不应该发生这种事情) @liang:2021-06-16 dayjs.extend(quarterOfYear) dayjs.extend(customParseFormat) dayjs.extend(advancedFormat) }