From 20e48ddfdc495b704e2aef830b6e4c49a64c80e2 Mon Sep 17 00:00:00 2001 From: Willy Hung Date: Wed, 30 Nov 2022 10:36:02 +0800 Subject: [PATCH] release: v2.0.0-beta.2 --- README-zh_TW.md | 12 ++++++------ README.md | 12 ++++++------ core/package.json | 2 +- package.json | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README-zh_TW.md b/README-zh_TW.md index bb89634..5ae75b1 100644 --- a/README-zh_TW.md +++ b/README-zh_TW.md @@ -381,9 +381,9 @@ mutate(newData) - 第二種:使用 callback function,會接受一個深拷貝的 `data` 資料,修改完後再返回結果 ```js -const finalData = mutate((currentData) => { - currentData[0].name = 'runkids' - return currentData +const finalData = mutate((draft) => { + draft[0].name = 'runkids' + return draft }) console.log(finalData[0]name === data.value[0].name) //true @@ -409,9 +409,9 @@ async function updateUserName (userId, newName, rowIndex = 0) { // 沒作用! 因為 `data` 是唯讀不可修改的. // Easy to use function will receive deep clone data, and return updated data. - mutate(currentData => { - currentData[rowIndex] = response.data - return currentData + mutate(draft => { + draft[rowIndex] = response.data + return draft }) console.log(data.value) //after: [{ id: 1, name: 'mutate name' }, { id: 2, name: 'vuejs' }] diff --git a/README.md b/README.md index caaabce..6f1a889 100644 --- a/README.md +++ b/README.md @@ -370,9 +370,9 @@ mutate(newData) - Second way, use function will receive deep clone data, and return updated data. ```js -const finalData = mutate((currentData) => { - currentData[0].name = 'runkids' - return currentData +const finalData = mutate((draft) => { + draft[0].name = 'runkids' + return draft }) console.log(finalData[0]name === data.value[0].name) //true @@ -398,9 +398,9 @@ async function updateUserName (userId, newName, rowIndex = 0) { // Not work! Because `data` is read only. // Easy to use function will receive deep clone data, and return updated data. - mutate(currentData => { - currentData[rowIndex] = response.data - return currentData + mutate(draft => { + draft[rowIndex] = response.data + return draft }) console.log(data.value) //after: [{ id: 1, name: 'mutate name' }, { id: 2, name: 'vuejs' }] diff --git a/core/package.json b/core/package.json index 9041173..29d4bac 100644 --- a/core/package.json +++ b/core/package.json @@ -1,6 +1,6 @@ { "name": "vue-condition-watcher-core", - "version": "0.0.1", + "version": "0.0.2", "main": "./dist/index.js", "module": "./dist/index.esm.js", "types": "./dist/index.d.ts", diff --git a/package.json b/package.json index 6358d1c..de8942e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-condition-watcher", - "version": "2.0.0-beta.1", + "version": "2.0.0-beta.2", "description": "Vue composition API for automatic data fetching. With conditions as the core. Easily control and sync to URL query string by conditions", "main": "./core/dist/index.js", "module": "./core/dist/index.esm.js",