Skip to content

Commit 20e48dd

Browse files
committed
release: v2.0.0-beta.2
1 parent 8a3b723 commit 20e48dd

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

README-zh_TW.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,9 @@ mutate(newData)
381381
- 第二種:使用 callback function,會接受一個深拷貝的 `data` 資料,修改完後再返回結果
382382

383383
```js
384-
const finalData = mutate((currentData) => {
385-
currentData[0].name = 'runkids'
386-
return currentData
384+
const finalData = mutate((draft) => {
385+
draft[0].name = 'runkids'
386+
return draft
387387
})
388388

389389
console.log(finalData[0]name === data.value[0].name) //true
@@ -409,9 +409,9 @@ async function updateUserName (userId, newName, rowIndex = 0) {
409409
// 沒作用! 因為 `data` 是唯讀不可修改的.
410410

411411
// Easy to use function will receive deep clone data, and return updated data.
412-
mutate(currentData => {
413-
currentData[rowIndex] = response.data
414-
return currentData
412+
mutate(draft => {
413+
draft[rowIndex] = response.data
414+
return draft
415415
})
416416

417417
console.log(data.value) //after: [{ id: 1, name: 'mutate name' }, { id: 2, name: 'vuejs' }]

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,9 @@ mutate(newData)
370370
- Second way, use function will receive deep clone data, and return updated data.
371371

372372
```js
373-
const finalData = mutate((currentData) => {
374-
currentData[0].name = 'runkids'
375-
return currentData
373+
const finalData = mutate((draft) => {
374+
draft[0].name = 'runkids'
375+
return draft
376376
})
377377

378378
console.log(finalData[0]name === data.value[0].name) //true
@@ -398,9 +398,9 @@ async function updateUserName (userId, newName, rowIndex = 0) {
398398
// Not work! Because `data` is read only.
399399

400400
// Easy to use function will receive deep clone data, and return updated data.
401-
mutate(currentData => {
402-
currentData[rowIndex] = response.data
403-
return currentData
401+
mutate(draft => {
402+
draft[rowIndex] = response.data
403+
return draft
404404
})
405405

406406
console.log(data.value) //after: [{ id: 1, name: 'mutate name' }, { id: 2, name: 'vuejs' }]

core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-condition-watcher-core",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"main": "./dist/index.js",
55
"module": "./dist/index.esm.js",
66
"types": "./dist/index.d.ts",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-condition-watcher",
3-
"version": "2.0.0-beta.1",
3+
"version": "2.0.0-beta.2",
44
"description": "Vue composition API for automatic data fetching. With conditions as the core. Easily control and sync to URL query string by conditions",
55
"main": "./core/dist/index.js",
66
"module": "./core/dist/index.esm.js",

0 commit comments

Comments
 (0)