diff --git a/src/guide/essentials/computed.md b/src/guide/essentials/computed.md index 0637bf51..9b47d853 100644 --- a/src/guide/essentials/computed.md +++ b/src/guide/essentials/computed.md @@ -122,7 +122,7 @@ const publishedBooksMessage = computed(() => { [在演練場中嘗試一下](https://play.vuejs.org/#eNp1kE9Lw0AQxb/KI5dtoTainkoaaREUoZ5EEONhm0ybYLO77J9CCfnuzta0vdjbzr6Zeb95XbIwZroPlMySzJW2MR6OfDB5oZrWaOvRwZIsfbOnCUrdmuCpQo+N1S0ET4pCFarUynnI4GttMT9PjLpCAUq2NIN41bXCkyYxiZ9rrX/cDF/xDYiPQLjDDRbVXqqSHZ5DUw2tg3zP8lK6pvxHe2DtvSasDs6TPTAT8F2ofhzh0hTygm5pc+I1Yb1rXE3VMsKsyDm5JcY/9Y5GY8xzHI+wnIpVw4nTI/10R2rra+S4xSPEJzkBvvNNs310ztK/RDlLLjy1Zic9cQVkJn+R7gIwxJGlMXiWnZEq77orhH3Pq2NH9DjvTfpfSBSbmA==) -Here we have declared a computed property `publishedBooksMessage`. The `computed()` function expects to be passed a [getter function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get#description), and the returned value is a **computed ref**. Similar to normal refs, you can access the computed result as `publishedBooksMessage.value`. Computed refs are also auto-unwrapped in templates so you can reference them without `.value` in template expressions. +我們在這裡定義了一個計算屬性 `publishedBooksMessage`。`computed()` 方法期望接收一個 [getter 函數](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get#description),它的返回值是一個**計算屬性 ref**。和一般的 ref 相似,你可以通過 `publishedBooksMessage.value` 来訪問計算的結果。計算屬性 ref 也會在模板中自動解包,所以你可以在模板表達式中引用時而無需添加 `.value`。 Vue 的計算屬性會自動追蹤響應式依賴。它會檢測到 `publishedBooksMessage` 依賴於 `author.books`,所以當 `author.books` 改變時,任何依賴於 `publishedBooksMessage` 的綁定都會同時更新。