# @ophiuchus/empty

> ### 介绍

Latest version **1.0.1** (published 2021-09-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ophiuchus/empty
pnpm add @ophiuchus/empty
yarn add @ophiuchus/empty
bun add @ophiuchus/empty
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-09-26 |
| First published | 2021-09-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | songbug1024 |
| Maintainers | songbug1024 |
| Keywords | ui, vue, frontend, component, ophiuchus, vant, vite |

## Links

- npm: https://www.npmjs.com/package/@ophiuchus/empty
- Homepage: https://github.com/songbug1024/ophiuchus
- Issues: https://github.com/songbug1024/ophiuchus/issues
- npm.io page: https://npm.io/package/@ophiuchus/empty

## Alternatives

- [@progress/kendo-ooxml](https://npm.io/package/@progress/kendo-ooxml.md) — 152.1K weekly downloads
- [@progress/kendo-react-ripple](https://npm.io/package/@progress/kendo-react-ripple.md) — 8.0K weekly downloads
- [@progress/kendo-react-orgchart](https://npm.io/package/@progress/kendo-react-orgchart.md) — 4.3K weekly downloads
- [@praxisui/dynamic-fields](https://npm.io/package/@praxisui/dynamic-fields.md) — 2.4K weekly downloads
- [@progress/kendo-vue-listbox](https://npm.io/package/@progress/kendo-vue-listbox.md) — 932 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2021-09-26
- 1.0.0 — 2021-09-08

## README

# Empty 空状态

### 介绍

空状态时的占位提示。

### 引入

```js
import Vue from 'vue';
import Empty from '@ophiuchus/empty';

Vue.use(Empty);
```

## 代码演示

### 基础用法

```html
<sf-empty description="描述文字" />
```

### 图片类型

Empty 组件内置了多种占位图片类型，可以在不同业务场景下使用。

```html
<!-- 通用错误 -->
<sf-empty image="error" description="描述文字" />
<!-- 网络错误 -->
<sf-empty image="network" description="描述文字" />
<!-- 搜索提示 -->
<sf-empty image="search" description="描述文字" />
```

### 自定义图片

需要自定义图片时，可以在 image 属性中传入任意图片 URL。

```html
<sf-empty
  class="custom-image"
  image="https://img4.tuhu.org/OfRUe9mR6SL-NuijriKZSg_w200_h200.png"
  description="描述文字"
/>

<style>
  .custom-image .sf-empty__image {
    width: 90px;
    height: 90px;
  }
</style>
```

### 底部内容

通过默认插槽可以在 Empty 组件的下方插入内容。

```html
<sf-empty description="描述文字">
  <sf-button round type="danger" class="bottom-button">按钮</sf-button>
</sf-empty>

<style>
  .bottom-button {
    width: 160px;
    height: 40px;
  }
</style>
```

## API

### Props

| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| image | 图片类型，可选值为 `error` `network` `search`，支持传入图片 URL | _string_ | `default` |
| image-size | 图片大小，默认单位为 `px` | _number \| string_ | - |
| description | 图片下方的描述文字 | _string_ | - |

### Slots

| 名称        | 说明           |
| ----------- | -------------- |
| default     | 自定义底部内容 |
| image       | 自定义图标     |
| description | 自定义描述文字 |

### 样式变量

组件提供了下列 Less 变量，可用于自定义样式，使用方法请参考[主题定制](#/theme)。

| 名称                           | 默认值            | 描述 |
| ------------------------------ | ----------------- | ---- |
| @empty-padding                 | `@padding-xl 0`   | -    |
| @empty-image-size              | `160px`           | -    |
| @empty-description-margin-top  | `@padding-md`     | -    |
| @empty-description-padding     | `0 60px`          | -    |
| @empty-description-color       | `@gray-6`         | -    |
| @empty-description-font-size   | `@font-size-md`   | -    |
| @empty-description-line-height | `@line-height-md` | -    |
| @empty-bottom-margin-top       | `24px`            | -    |

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