# @fekit/mc-watch

> scroll to id or pos

Latest version **1.0.3** (published 2020-04-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @fekit/mc-watch
pnpm add @fekit/mc-watch
yarn add @fekit/mc-watch
bun add @fekit/mc-watch
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2020-04-07 |
| First published | 2019-12-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | xiaojunbo |
| Maintainers | xiaojunbo |
| Keywords | watch |

## Links

- npm: https://www.npmjs.com/package/@fekit/mc-watch
- Repository: https://gitlab.com/fekits/mc-toast
- Homepage: https://gitlab.com/fekits/mc-toast#readme
- Issues: https://gitlab.com/fekits/mc-toast/issues
- npm.io page: https://npm.io/package/@fekit/mc-watch

## Recent versions

- 1.0.3 (latest) — 2020-04-07
- 1.0.2 — 2020-04-07
- 1.0.1 — 2019-12-11
- 1.0.0 — 2019-12-09

## README

# @FEKIT/MC-WATCH
```$xslt
一个数据双向绑定的小功能插件
```

#### 索引
* [演示](#演示)
* [参数](#参数)
* [示例](#示例)
* [版本](#版本)
* [反馈](#反馈)


#### 演示
[http://fekit.asnowsoft.com/plugins/mc-watch](http://fekit.asnowsoft.com/plugins/mc-watch)


#### 开始

下载项目: 

```npm
npm i @fekit/mc-watch
```

#### 参数
```$xslt
{
  data:                         需要监听数据的对象
  item:                         监听对象中的一个属性名
  from:                         数据修改的来源，一般为一个input标签，但是也可以是其它标签；也可以不填，直接操作数据对象
  updated(newValue,oldValue):   数据变化时的回调,回调可以取得两个参数，一个是更新的值，一个是原来的值
}
```

#### 示例

```javascript
  import watch from '@fekit/mc-watch';

  let data = {
    title:'这是一个标题'
  }

  // 实例代码1
  watch({
    data: data,
    item: 'title',
    from: document.getElementById('input'),
    updated(newValue,oldValue) {
      console.log('原来的数据是' + oldValue);
      console.log('更新的数据是' + newValue);
      document.getElementById('title').innerText = newValue;
    }
  });

```

#### 版本
```$xslt [last vension]
v1.0.3
1. 修复一个更新数据后执行两次的BUG
```

```$xslt
v1.0.0
1. 完成基础功能
```

#### 反馈
```$xslt
如果您在使用中遇到问题，请通过以下方式联系我。
email: xiaojunbo@126.com
```

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