在ts中使用dayjs

分为两种情况:

  1. 没有在tsconfig.json中进行如下配置
"compilerOptions": {
    
    
        "esModuleInterop": true,
        "allowSyntheticDefaultImports": true,
    }

在使用dayjs的页面中通过如下进行导入

important * as dayjs from 'dayjs';
  1. 如果进行了配置,则需要通过如下方式导入
important dayjs from 'dayjs';

猜你喜欢

转载自blog.csdn.net/weixin_42937036/article/details/108013376
今日推荐