sf-utils2 sf-utils2
版本v3.3.3-beta1
首页
  • 01.快速开始 🔥
  • 02.基础-Base
  • 03.对象-Object
  • 04.数组-Array
  • 05.方法-Function
  • 06.字符串-String
  • 07.数学-Math
  • 08.dom
  • 09.拓展
  • webpack5.x教程学习 (opens new window)
  • 例子
  • 教程 🔥
  • 例子配置
企业级后台模版 (opens new window)
版本v3.3.3-beta1
首页
  • 01.快速开始 🔥
  • 02.基础-Base
  • 03.对象-Object
  • 04.数组-Array
  • 05.方法-Function
  • 06.字符串-String
  • 07.数学-Math
  • 08.dom
  • 09.拓展
  • webpack5.x教程学习 (opens new window)
  • 例子
  • 教程 🔥
  • 例子配置
企业级后台模版 (opens new window)
  • 快速开始

    • 概要
    • 全局安装
    • 按需加载
  • 基础-Base

  • 对象-Object

  • 数组-Array✨✨✨

  • 方法-Function

  • 字符串-String

  • 数学-Math

  • 文件-Buffer

  • 节点-dom

  • 拓展

  • nodejs

按需加载

如果您使用了 babel,借助插件 babel-plugin-import 可以实现按需加载模块,减少文件体积。

    yarn add babel-plugin-import -D
    
    1
    npm i babel-plugin-import -D
    
    1
    // Make sure to add code blocks to your code group

    • 修改文件 .babelrc 或 babel.config.js
        {
          "plugins": [
            [
              "import",
              {
                "libraryName": "sfutils",
                "camel2DashComponentName": false
              },
              "sfutils"
            ]
          ]
        }
      
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
        module.exports = {
          presets: ...,
          env: {
            ...
          },
          plugins: [
            // 注意⚠️:写在这
            [
              'import',
              {
                libraryName: 'sf-utils2',
                camel2DashComponentName: false
              },
              'sf-utils2'
            ]
          ]
        }
      
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      // Make sure to add code blocks to your code group
      • 图片
      上次更新: 2023/06/24, 19:35:48
      全局安装
      序言 👏

      ← 全局安装 序言 👏→

      Theme by Vdoing | Copyright © 2022-2025 bianpengfei
      • 跟随系统
      • 浅色模式
      • 深色模式
      • 阅读模式
      ×