Skip to content

Commit dc55dd8

Browse files
committed
add README-zh.md and Update README.md
1 parent 71d25f4 commit dc55dd8

File tree

2 files changed

+122
-0
lines changed

2 files changed

+122
-0
lines changed

README-zh.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Vue-Array [![npm](https://img.shields.io/npm/dy/vue-array.svg)](https://www.npmjs.com/package/vue-array) [![npm](https://img.shields.io/github/issues/BlackHole1/vue-array.svg)](https://github.com/BlackHole1/all-equal) [![npm](https://img.shields.io/github/forks/BlackHole1/vue-array.svg)](https://github.com/BlackHole1/all-equal) [![npm](https://img.shields.io/github/stars/BlackHole1/vue-array.svg)](https://github.com/BlackHole1/all-equal) [![npm](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/BlackHole1/all-equal)
2+
3+
[English documents](https://github.com/BlackHole1/vue-array/blob/master/README.md)
4+
5+
> 使用此package来操作数组。vue是可以监听到数组中的更改的
6+
7+
## 安装
8+
9+
```bash
10+
# npm安装
11+
$ npm install vue-array --save
12+
13+
# yarn安装
14+
$ yarn add vue-array
15+
```
16+
17+
## 使用
18+
19+
### vue插件
20+
21+
demo: [https://codesandbox.io/s/jppo9w6yyw](https://codesandbox.io/s/jppo9w6yyw)
22+
23+
### 普通方法
24+
25+
```javascript
26+
let vueArray = require('../').$array
27+
28+
let arr = [1, 2, 3]
29+
vueArray(arr).remove([2])
30+
console.log(arr) // => [1, 3]
31+
32+
vueArray(arr).replace([4, 5, 6])
33+
console.log(arr) // => [4, 5, 6]
34+
```
35+
36+
### 注入方法
37+
38+
```javascript
39+
let arrInstance = Array
40+
require('vue-array').injection(arrInstance)
41+
42+
let arr = [1, 2, 3]
43+
[].$array(arr).remove([3,1])
44+
console.log(arr) // => [2]
45+
46+
[].$array(arr).replace([4, 5, 6])
47+
console.log(arr) // => [4, 5, 6]
48+
```
49+
50+
## API
51+
52+
### remove
53+
54+
> 支持 numbers, strings, Boolean, Null Undefined NaN, Object, Array, ±0
55+
56+
> 如果是对象、数组,会进行递归操作
57+
58+
```javascript
59+
let arr = [
60+
"abc", 123, -0, 0, false, true, null, undefined, NaN,
61+
[1, 2, 3],
62+
[4, 5, 6],
63+
{a: 1},
64+
{b: 1},
65+
[{a: 2}],
66+
[{b: 2}],
67+
{a: [7,8, {b: 3}]}
68+
]
69+
70+
vueArray(arr).remove([
71+
null, true, 0, "abc", NaN,
72+
[1, 2, 3],
73+
[{b: 2}],
74+
{a: 1},
75+
{a: [7,8, {b: 3}]}
76+
])
77+
78+
console.log(arr)
79+
/**
80+
[
81+
123, -0, fasle, undefined,
82+
[4, 5, 6],
83+
{b: 1},
84+
[{a: 2}],
85+
]
86+
**/
87+
```
88+
89+
### replace
90+
91+
```javascript
92+
let arr = [1, 2, 3, 4, 'a', NaN, {a: 1}, [2,1]]
93+
vueArray(arr).replace(['a', 'b', 'c'])
94+
95+
console.log(arr) // => ['a', 'b', 'c']
96+
```
97+
98+
## 运行测试
99+
100+
安装dev依赖关系:
101+
102+
``` bash
103+
$ npm i -D && npm test
104+
```
105+
106+
## 贡献
107+
108+
109+
| **次数** | **贡献者** |
110+
| --- | --- |
111+
| 7 | [Black-Hole](https://github.com/BlackHole1) |
112+
113+
## 作者
114+
115+
**Black-Hole**
116+
117+
* Email:158blackhole@gmail.com
118+
* Blog:[http://bugs.cc](http://bugs.cc)
119+
* WeiBo:[http://weibo.com/comelove](http://weibo.com/comelove)
120+
* Twitter:[https://twitter.com/Free_BlackHole](https://twitter.com/Free_BlackHole)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Vue-Array [![npm](https://img.shields.io/npm/dy/vue-array.svg)](https://www.npmjs.com/package/vue-array) [![npm](https://img.shields.io/github/issues/BlackHole1/vue-array.svg)](https://github.com/BlackHole1/all-equal) [![npm](https://img.shields.io/github/forks/BlackHole1/vue-array.svg)](https://github.com/BlackHole1/all-equal) [![npm](https://img.shields.io/github/stars/BlackHole1/vue-array.svg)](https://github.com/BlackHole1/all-equal) [![npm](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/BlackHole1/all-equal)
22

3+
[中文文档](https://github.com/BlackHole1/vue-array/blob/master/README-zh.md)
4+
35
> Use this package to manipulate the array. Vue can monitor the changes in the array
46
57
## install

0 commit comments

Comments
 (0)