npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wil-loading

v1.0.0

Published

通用loading组件

Downloads

5

Readme

wil-loading

通用loading组件。默认提供两种loading方式。

Demo示例
前往Gitee

注意

  1. 由于此组件使用了document.body方法,所以必须在<body>标签内引用此组件,否则会出现报错;
  2. 本组件不支持 import 的方式引入。

安装

npm install wil-loading
# 安装 raw-loader,要求版本号为 0.5.1 版本
npm install [email protected]

在 html 文件内使用 <script> 标签内联引入

<script><%=require('raw-loader!wil-loading')%></script>

使用此方式引入组件。必须在最靠近 <body> 标签的位置使用 <script> 标签引入。

使用方式

/** 自定义 Loading 样式 */
loading.custom({
  content: 'loading...',
  bg: 'background-color: black',
  txt: 'color: white'
});
/** 显示 Loading */
loading.show();
/** 隐藏 Loading */
loading.hide();
/** 自定义 icon */
loading.custom({
    pos: 'padding: 39px; background: rgba(0,0,0,0.7); border-radius: 12px; border: 1px solid rgba(255,255,255,1);',
    // 此icon链接只能公司内网访问,生产环境不可使用此icon链接!!
    icon: 'http://xxx.xx/static/loading_icon.png',
    img: 'width: 30px; height: 30px; margin:0;',
    content: ''
  });

API

loading.custom(Object object);

自定义 Loading 样式,若没有自定义 Loading 样式的需求,不需要调用此方法。
调用此方法参数不能为空

| 属性 | 类型 | 默认值 | 是否必填 | 说明 | | ------- | ------ | ---------------| -------- | ----------------------------------------------------------- | | content | String | '加载中...' | 否 | loading 文本提示 | | bg | String | 无 | 否 | 背景样式,cssText写法,传参后,会有一个遮罩层,隔离底部的dom事件 | | txt | String | 无 | 否 | 文本样式,cssText写法 | | icon | String | 无 | 否 | icon图标 | | pos | String | 无 | 否 | icon和文本的容器dom样式,cssText写法 | | img | String | 无 | 否 | icon样式,cssText写法 |

loading.show();

显示 Loading

loading.hide();

隐藏 Loading