# teo-utils

> Teo 的工具集

Latest version **0.0.6** (published 2018-02-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install teo-utils
pnpm add teo-utils
yarn add teo-utils
bun add teo-utils
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2018-02-07 |
| First published | 2018-02-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 4.0.0 |
| Dependencies | 6 |
| Unpacked size | 1.1 MB |
| Known vulnerabilities | 0 (+26 in 2 direct dependencies) |
| Install scripts | no |
| Author | Teo.Xu |
| Maintainers | teoxu |
| Keywords | utils |

## Links

- npm: https://www.npmjs.com/package/teo-utils
- Repository: https://github.com/Cheesenx/vue-components
- Homepage: https://github.com/Cheesenx/vue-components#readme
- Issues: https://github.com/Cheesenx/vue-components/issues
- npm.io page: https://npm.io/package/teo-utils

## Dependencies (6)

- [vue](https://npm.io/package/vue.md) ^2.2.2
- [axios](https://npm.io/package/axios.md) ^0.16.2
- [smartcrop](https://npm.io/package/smartcrop.md) ^1.1.1
- [teo-utils](https://npm.io/package/teo-utils.md) ^0.0.2
- [vue-router](https://npm.io/package/vue-router.md) ^2.2.0
- [babel-polyfill](https://npm.io/package/babel-polyfill.md) ^6.26.0

## Recent versions

- 0.0.6 (latest) — 2018-02-07
- 0.0.5 — 2018-02-07
- 0.0.4 — 2018-02-07
- 0.0.2 — 2018-02-07

## README

# VUE工具开发
```bash
#bash

npm install teo-utils --save
```

```js
//main.js

import utils from 'tui-utils'
Vue.use(utils)
```
### Smart-Img.vue 智能裁剪

- 在不能完全展示图片全尺寸的情况下，图片将智能选区，自动裁剪最佳区域并生成一张新图

- 生成的为canvas图，且高宽都为100%，所以父容器需要固定高宽

```html
<!-- xxx.vue -->

<Smart-Img :imgURL='imgURL' :cropWidth="width" :cropHeight="height"></Smart-Img>
```
| 参数 | 说明 | 类型 |
| -------- | -----: | ----: |
| imgURL | 图片地址 | String |
| cropWidth | 裁剪宽度 | Number |
| cropHeight | 裁剪高度 | Number |

### v-scroll-text 指令

- 文本溢出时自动左右来回滚动

- div 需要有固定的宽度

```html
<!-- xxx.vue -->

<div v-scroll-text:speed="text"></div>
```

| 参数 | 说明 | 类型 |
| -------- | -----: | :----: |
| v-scroll-text | 滚动指令 | String |
| text | 纯文本 | String |
| speed | 速度/毫秒(可选) | Number |

### 通用对话框

- 通用的对话框，需自定义宽度和居中

```html
<!-- xxx.vue -->

<Tui-Dialog :show.sync="绑定显示属性" @on-hide="关闭事件">这里放自定义内容</Tui-Dialog>
```

### 请求后缓存
- 基于axios修改的

```js
// 用法
this.$storage({
  name: '缓存名[必选]',
  type: 'local || session 缓存类型[默认session]',
  timeout: '1000 过期时间[毫秒]，[默认7天]',
  url: 'axios请求地址[必选]',
  httpType: 'get || post 请求类型[默认get]',
  params: 'axios请求参数，按axios格式[可选]',
  status: 'err_code=200[必选]',
  success: (res) => {
    // res为axios请求成功返回的结果
  }
})
```

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