# @wines/loading

> The loading @wines

Latest version **2.0.0** (published 2025-04-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install @wines/loading
pnpm add @wines/loading
yarn add @wines/loading
bun add @wines/loading
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2025-04-01 |
| First published | 2021-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=16.0.0 |
| Dependencies | 4 |
| Unpacked size | 18.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | tianyingchun |

## Links

- npm: https://www.npmjs.com/package/@wines/loading
- Repository: https://gitlab.itcjf.com/wines/loading
- npm.io page: https://npm.io/package/@wines/loading

## Dependencies (4)

- [@wines/core](https://npm.io/package/@wines/core.md) 2.0.0
- [@wines/styles](https://npm.io/package/@wines/styles.md) 2.0.0
- [@wines/backdrop](https://npm.io/package/@wines/backdrop.md) 2.0.0
- [@wines/animation-group](https://npm.io/package/@wines/animation-group.md) 2.0.0

## Recent versions

- 2.0.0 (latest) — 2025-04-01
- 2.0.0-next.7 (next) — 2025-04-01
- 2.0.0-next.6 — 2025-03-06
- 2.0.0-next.5 — 2025-03-05
- 2.0.0-next.4 — 2025-03-05
- 2.0.0-next.3 — 2025-03-04
- 2.0.0-next.2 — 2025-02-28
- 2.0.0-next.1 — 2025-02-27
- 2.0.0-next.0 — 2025-02-27
- 1.5.1 — 2023-03-07
- 1.5.0 — 2022-11-22
- 1.4.0 — 2022-02-23
- 1.3.5 — 2021-12-03
- 1.3.4 — 2021-09-26
- 1.3.2 — 2021-09-24
- … 2 more at https://npm.io/package/@wines/loading/versions

## README

# `@wines/loading`

# Loading 指示器

用于展现 loading 提示框。

## 使用指南

### 在 page.json 中引入组件

```json
{
  "navigationBarTitleText": "Loading",
  "usingComponents": {
    "wux-button": "@wines/button",
    "wux-loading": "@wines/loading"
  }
}
```

### 示例

> 该组件主要依靠 JavaScript 主动调用，所以一般只需在 wxml 中添加一个组件，并设置 id 为 `#wux-loading` 或其他，之后在 page.js 中调用 `$wuxLoading(this, id)` 获取匹配到的第一个组件实例对象。

```xml
<wux-loading id="wux-loading" />
<view class="page">
	<view class="page__hd">
		<view class="page__title">Loading</view>
		<view class="page__desc">指示器</view>
	</view>
	<view class="page__bd page__bd_spacing">
		<wux-button block type="light" bind:click="showLoading">加载中提示</wux-button>
	</view>
</view>

```

```ts
import './index.less';
import { $wuxLoading } from '@wines/loading';
import { PageData, PageCustom } from '@wines/core';

Page<PageData, PageCustom>({
  data: {
    name: '',
  },
  onLoad() {
    /** */
  },
  showLoading() {
    const wuxLoading = $wuxLoading();
    wuxLoading.show({
      text: '数据加载中',
    });
    setTimeout(() => {
      wuxLoading.hide();
    }, 1500);
  },
});
```

## API

| 参数                | 类型      | 描述                                                                    | 默认值              |
| ------------------- | --------- | ----------------------------------------------------------------------- | ------------------- |
| options             | `object`  | 配置项                                                                  | -                   |
| options.prefixCls   | `string`  | 自定义类名前缀                                                          | wux-loading         |
| options.classNames  | `any`     | 过渡的类名，更多内置过渡效果请参考 [AnimationGroup](animation-group.md) | wux-animate--fadeIn |
| options.text        | `string`  | 提示文本                                                                | 数据加载中          |
| options.mask        | `boolean` | 是否显示蒙层                                                            | true                |
| options.transparent | `boolean` | 蒙层是否透明                                                            | false               |

### Loading.method

- Loading.show
- Loading.hide

---
_Source: https://npm.io/package/@wines/loading · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
