Function loadCSS

  • EN: Load a CSS file from the server.

    ZH: 动态加载 CSS 文件

    Usage:

    loadCSS(
    'http://example.com/path/example.css',
    {
    id: 'iamid', // Optional, link ID, default none
    }
    )
    .then(
    res => {
    console.log(`Load CSS Success: ${res}`);
    }
    )
    .catch(
    err => {
    console.error(`Load CSS Fail: ${err.message}`)
    }
    );

    Output:

    Load CSS Success: loaded
    

    Parameters

    • url: string

      css资源路径

    • options: {
          id?: string;
      } = ...
      • Optional id?: string

        link标签id

    Returns Promise<unknown>

    true -- 加载成功