# @linh-txl/use-scrollbar

> ```bash pnpm add @linh-txl/use-scrollbar ```

Latest version **0.0.5** (published 2023-11-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install @linh-txl/use-scrollbar
pnpm add @linh-txl/use-scrollbar
yarn add @linh-txl/use-scrollbar
bun add @linh-txl/use-scrollbar
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2023-11-21 |
| First published | 2023-11-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 25.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 2 |
| Author | linh |
| Maintainers | linhaotxl |
| Keywords | vue3, ant-design-vue, crud |

## Links

- npm: https://www.npmjs.com/package/@linh-txl/use-scrollbar
- Repository: https://github.com/linhaotxl/use-scrollbar
- Issues: https://github.com/linhaotxl/use-scrollbar/issues
- npm.io page: https://npm.io/package/@linh-txl/use-scrollbar

## Dependencies (2)

- [vue](https://npm.io/package/vue.md) ^3.3.8
- [big.js](https://npm.io/package/big.js.md) ^6.2.1

## Recent versions

- 0.0.5 (latest) — 2023-11-21
- 0.0.4 — 2023-11-21
- 0.0.3 — 2023-11-18
- 0.0.2 — 2023-11-18
- 0.0.1 — 2023-11-17

## README

## 安装

```bash
pnpm add @linh-txl/use-scrollbar
```

## 使用

```ts
// 引入样式
import '@linh-txl/use-scrollbar/index.css'
```

### 组件方式

```html
<script lang="ts" setup>
import { ScrollBar } from '@linh-txl/use-scrollbar'
</script>

<template>
  <!-- 垂直 scroll-bar 必须指定 height-->
  <h2>Comp Scroll Bar Vertical</h2>
  <scroll-bar style="height: 300px">
    <div class="list">
      <div v-for="item in 115" :key="item">{{ item }}</div>
    </div>
  </scroll-bar>

  <!-- 水平 scroll-bar 必须指定 width-->
  <h2>Comp Scroll Bar Horizontal</h2>
  <scroll-bar style="width: 500px">
    <div class="list" style="display: flex; gap: 8px;">
      <div v-for="item in 300" :key="item">{{ item }}</div>
    </div>
  </scroll-bar>
</template>
```



### 调用方法

```html
<script>
import { useScrollbar } from '@linh-txl/use-scrollbar'

const verticalRef = ref<HTMLDivElement | null>(null)
const horizontalRef = ref<HTMLDivElement | null>(null)

useScrollbar(verticalRef)
useScrollbar(horizontalRef)
</script>

<template>
  <h2>Func Scroll Bar Vertical</h2>
  <div class="wrap" style="height: 300px">
    <div ref="verticalRef" class="view">
      <div v-for="item in 115" :key="item">{{ item }}</div>
    </div>
  </div>

  <h2>Func Scroll Bar Horizontal</h2>
  <div class="wrap" style="width: 300px">
    <div ref="horizontalRef" class="view" style="display: flex; gap: 4px;">
      <div v-for="item in 115" :key="item">{{ item }}</div>
    </div>
  </div>
</template>
```

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