1.0.1 • Published 2 years ago
@wry-smile/vite-plugin-antd-use-dayjs v1.0.1
vite-plugin-antd-use-dayjs
react antd library use dayjs
replace Moment with Dayjs in antd project
Usage 使用方法
- npm i dayjs
- npm i @wry-smile/vite-plugin-antd-use-dayjs
Example 示例
// In vite.config.ts
import { vitePluginAntdUseDayjs } from '@wry-smile/vite-plugin-antd-use-dayjs'
export default defineConfig({
plugins: [
// default locale zh-cn
vitePluginAntdUseDayjs.vite(),
// or
vitePluginAntdUseDayjs.vite({
locale: 'en',
}),
// or Turn off automatic plugin localization
vitePluginAntdUseDayjs.vite({
defaultLocale: false
})
],
})
// If you set defaultLocale to false, you can do locale in Main.tsx
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
dayjs.locale('zh-cn')