Skip to content

Commit 07b415c

Browse files
ikxinKiritaniAyaka
andauthored
Apply suggestions from code review
Co-authored-by: 时瑶 <[email protected]>
1 parent d044079 commit 07b415c

15 files changed

+56
-55
lines changed

src/api/application.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ console.log(app.config)
627627

628628
## app.config.idPrefix <sup class="vt-badge" data-text="3.5+" /> {#app-config-idprefix}
629629

630-
通过 [useId()](/api/general#useid) 配置此应用程序中生成的所有 ID 的前缀。
630+
配置此应用中通过 [useId()](/api/general#useid) 生成的所有 ID 的前缀。
631631

632632
- **类型:** `string`
633633

@@ -640,7 +640,7 @@ console.log(app.config)
640640
```
641641

642642
```js
643-
// in a component:
643+
// 在组件中:
644644
const id1 = useId() // 'my-app:0'
645645
const id2 = useId() // 'my-app:1'
646646
```
@@ -655,10 +655,10 @@ console.log(app.config)
655655

656656
- **详情**
657657

658-
默认情况下,在 Vue 应用程序中抛出的但未显式处理的错误在开发模式和生产模式之间有不同的行为
658+
默认情况下,在 Vue 应用中抛出但未显式处理的错误在开发和生产模式下有不同的行为
659659

660-
- 在开发模式下,错误会被抛出并可能导致应用程序崩溃。这是为了使错误更加突出,以便在开发过程中被注意到并修复。
660+
- 在开发模式下,错误会被抛出并可能导致应用崩溃。这是为了使错误更加突出,以便在开发过程中被注意到并修复。
661661

662-
- 在生产模式下,错误只会被记录到控制台以尽量减少对最终用户的影响。然而,这可能会阻止只在生产中发生的错误被错误监控服务捕获
662+
- 在生产模式下,错误只会被记录到控制台以尽量减少对最终用户的影响。然而,这可能会导致只在生产中发生的错误无法被错误监控服务捕获
663663

664664
通过将 `app.config.throwUnhandledErrorInProduction` 设置为 `true`,即使在生产模式下也会抛出未处理的错误。

src/api/built-in-components.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,9 @@ h(Transition, {
287287
*/
288288
disabled?: boolean
289289
/**
290-
* When `true`, the Teleport will defer until other
291-
* parts of the application have been mounted before
292-
* resolving its target. (3.5+)
290+
* 当值为 `true` 时,Teleport 将推迟
291+
* 直到应用的其他部分挂载后
292+
* 再解析其目标。(3.5+)
293293
*/
294294
defer?: boolean
295295
}
@@ -313,12 +313,12 @@ h(Transition, {
313313
</Teleport>
314314
```
315315

316-
推迟目标解决 <sup class="vt-badge" data-text="3.5+" />:
316+
推迟解析目标 <sup class="vt-badge" data-text="3.5+" />:
317317

318318
```vue-html
319319
<Teleport defer to="#late-div">...</Teleport>
320320
321-
<!-- somewhere later in the template -->
321+
<!-- 稍后出现于模板中的某处 -->
322322
<div id="late-div"></div>
323323
```
324324

src/api/built-in-directives.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,17 +259,17 @@
259259

260260
- **缩写:**
261261
- `:` 或者 `.` (当使用 `.prop` 修饰符)
262-
- 省略值(当属性和绑定值具有相同的名称时,需要 3.4+)
262+
- 值可以省略(当 attribute 和绑定的值同名时,需要 3.4+ 版本
263263

264264
- **期望:**`any (带参数) | Object (不带参数)`
265265

266266
- **参数:**`attrOrProp (可选的)`
267267

268268
- **修饰符**
269269

270-
- `.camel` - 将 kebab-case 属性名称转换为 camelCase
271-
- `.prop` - 强制绑定为 DOM 属性(3.2+)。
272-
- `.attr` - 强制绑定为 DOM 属性(3.2+)。
270+
- `.camel` - 将短横线命名的 attribute 转变为驼峰式命名
271+
- `.prop` - 强制绑定为 DOM property(3.2+)。
272+
- `.attr` - 强制绑定为 DOM attribute(3.2+)。
273273

274274
- **用途**
275275

@@ -470,7 +470,7 @@
470470

471471
## v-memo {#v-memo}
472472

473-
- Only supported in 3.2+
473+
- 仅在 3.2+ 中支持
474474

475475
- **期望的绑定值类型:**`any[]`
476476

src/api/built-in-special-attributes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191

9292
- **预期**`string | Component`
9393

94-
- **本地元素的使用**
94+
- **用于原生元素**
9595

9696
- 仅在 3.1+ 中支持
9797

src/api/composition-api-dependency-injection.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109

110110
## hasInjectionContext() {#has-injection-context}
111111

112-
- Only supported in 3.3+
112+
- 仅在 3.3+ 中支持
113113

114114
如果 [inject()](#inject) 可以在错误的地方 (例如 `setup()` 之外) 被调用而不触发警告,则返回 `true`。此方法适用于希望在内部使用 `inject()` 而不向用户发出警告的库。
115115

src/api/general.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131

132132
### 函数签名 {#function-signature}
133133

134-
- 仅支持 3.3+
134+
- 仅在 3.3+ 中支持
135135

136136
`defineComponent()` 还有一种备用签名,旨在与组合式 API 和[渲染函数或 JSX](/guide/extras/render-function.html) 一起使用。
137137

src/api/options-rendering.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@
8686

8787
## slots<sup class="vt-badge ts"/> {#slots}
8888

89-
- 仅支持 3.3+
89+
- 仅在 Vue 3.3+ 中支持。
9090

91-
An option to assist with type inference when using slots programmatically in render functions.
91+
一个在渲染函数中以编程方式使用插槽时辅助类型推断的选项。
9292

9393
- **详情**
9494

src/api/reactivity-advanced.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@
336336

337337
这个方法可以作为可复用的组合式函数中 `onUnmounted` 的替代品,它并不与组件耦合,因为每一个 Vue 组件的 `setup()` 函数也是在一个 effect 作用域中调用的。
338338

339-
如果在没有活动效果范围的情况下调用此函数,将会抛出警告。在 3.5 版本及以上,可以通过将 `true` 作为第二个参数传递来抑制此警告
339+
如果在没有 effect 作用域的情况下调用此函数,将会抛出警告。在 3.5+ 版本中,可以通过将第二个参数设为 `true` 来抑制此警告
340340

341341
- **类型**
342342

src/api/reactivity-core.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,12 @@
300300
stop()
301301
```
302302

303-
暂停/恢复观察者:<sup class="vt-badge" data-text="3.5+" />
303+
暂停/恢复侦听器:<sup class="vt-badge" data-text="3.5+" />
304304

305305
```js
306306
const { stop, pause, resume } = watchEffect(() => {})
307307
308-
// 临时暂停观察者
308+
// 暂停侦听器
309309
pause()
310310
311311
// 稍后恢复
@@ -320,8 +320,8 @@
320320
```js
321321
watchEffect(async (onCleanup) => {
322322
const { response, cancel } = doAsyncWork(newId)
323-
// 如果 `id` 更改,则将调用 `cancel`
324-
// 如果之前的请求尚未完成
323+
// 如果 `id` 变化,则调用 `cancel`
324+
// 如果之前的请求未完成,则取消该请求
325325
onCleanup(cancel)
326326
data.value = await response
327327
})
@@ -334,8 +334,8 @@
334334
335335
watchEffect(async () => {
336336
const { response, cancel } = doAsyncWork(newId)
337-
// `cancel` will be called if `id` changes, cancelling
338-
// the previous request if it hasn't completed yet
337+
// 如果 `id` 变化,则调用 `cancel`
338+
// 如果之前的请求未完成,则取消该请求
339339
onWatcherCleanup(cancel)
340340
data.value = await response
341341
})
@@ -411,7 +411,7 @@
411411
}
412412
413413
interface WatchHandle {
414-
(): void // callable, same as `stop`
414+
(): void // 可调用,与 `stop` 相同
415415
pause: () => void
416416
resume: () => void
417417
stop: () => void
@@ -438,10 +438,10 @@
438438
第三个可选的参数是一个对象,支持以下这些选项:
439439

440440
- **`immediate`**:在侦听器创建时立即触发回调。第一次调用时旧值是 `undefined`
441-
- **`deep`**:如果源是对象,则强制进行深度遍历,以便在深度变化时触发回调。在 3.5+ 版本中,此参数还可以是指示最大遍历深度的数字。请参阅[深度观察者](/guide/essentials/watchers#deep-watchers)。
441+
- **`deep`**:如果源是对象,强制深度遍历,以便在深层级变更时触发回调。在 3.5+ ,此参数还可以是指示最大遍历深度的数字。参考[深层侦听器](/guide/essentials/watchers#deep-watchers)。
442442
- **`flush`**:调整回调函数的刷新时机。参考[回调的刷新时机](/guide/essentials/watchers#callback-flush-timing)及 [`watchEffect()`](/api/reactivity-core#watcheffect)。
443443
- **`onTrack / onTrigger`**:调试侦听器的依赖。参考[调试侦听器](/guide/extras/reactivity-in-depth#watcher-debugging)。
444-
- **`once`**:(3.4+仅运行回调一次。观察者在第一次回调运行后自动停止
444+
- **`once`**:(3.4+回调函数只会运行一次。侦听器将在回调函数首次运行后自动停止
445445

446446
与 [`watchEffect()`](#watcheffect) 相比,`watch()` 使我们可以:
447447

@@ -525,18 +525,18 @@
525525
stop()
526526
```
527527

528-
暂停/恢复观察者: <sup class="vt-badge" data-text="3.5+" />
528+
暂停/恢复侦听器: <sup class="vt-badge" data-text="3.5+" />
529529

530530
```js
531531
const { stop, pause, resume } = watchEffect(() => {})
532532
533-
// temporarily pause the watcher
533+
// 暂停侦听器
534534
pause()
535535
536-
// resume later
536+
// 稍后恢复
537537
resume()
538538
539-
// stop
539+
// 停止
540540
stop()
541541
```
542542

@@ -571,7 +571,7 @@
571571

572572
## onWatcherCleanup() <sup class="vt-badge" data-text="3.5+" /> {#onwatchercleanup}
573573

574-
注册一个清理函数,当前的观察者即将重新运行时执行。只能在 `watchEffect` 效果函数或 `watch` 回调函数的同步执行期间调用(即不能在异步函数的 `await` 语句之后调用)。
574+
注册一个清理函数,在当前侦听器即将重新运行时执行。只能在 `watchEffect` 作用函数或 `watch` 回调函数的同步执行期间调用(即不能在异步函数的 `await` 语句之后调用)。
575575

576576
- **类型**
577577

@@ -589,7 +589,8 @@
589589
590590
watch(id, (newId) => {
591591
const { response, cancel } = doAsyncWork(newId)
592-
// 如果 `id` 发生更改,将调用 `cancel` 来取消前一个请求,以防它尚未完成。
592+
// 如果 `id` 变化,则调用 `cancel`
593+
// 如果之前的请求未完成,则取消该请求
593594
onWatcherCleanup(cancel)
594595
})
595596
```

src/api/reactivity-utilities.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134

135135
## toValue() {#tovalue}
136136

137-
- Only supported in 3.3+
137+
- 仅在 3.3+ 中支持
138138

139139
将值、refsgetters 规范化为值。这与 [unref()](#unref) 类似,不同的是此函数也会规范化 getter 函数。如果参数是一个 getter,它将会被调用并且返回它的返回值。
140140

0 commit comments

Comments
 (0)