File tree 1 file changed +9
-10
lines changed 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change 2
2
3
3
[[ toc]]
4
4
5
- ## 使用 Vitest 模拟日期和定时器
5
+ ## 使用 Vitest 模拟日期和计时器
6
6
7
- Vue 的调度器依赖于系统时间。在调用 ` vi.setSystemTime ` 之后再挂载组件 ,因为 Vue 依赖于其副作用。在调用 ` vi.setSystemTime ` 之前挂载组件可能会导致响应性中断 。
7
+ Vue 的调度器依赖于系统时间。请务必在调用 ` vi.setSystemTime ` 后再挂载组件 ,因为 Vue 依赖于其副作用。在调用 ` vi.setSystemTime ` 之前挂载组件可能会破坏其响应性 。
8
8
9
- 请参见 [ vuejs/test-utils #2074 ] ( https://github.com/vuejs/test-utils/issues/2074 ) 。
9
+ 请查看 [ vuejs/test-utils #2074 ] ( https://github.com/vuejs/test-utils/issues/2074 ) 。
10
10
11
11
## Vue warn: Failed setting prop
12
12
@@ -15,18 +15,17 @@ Vue 的调度器依赖于系统时间。在调用 `vi.setSystemTime` 之后再
15
15
TypeError: Cannot set property prefix of #<Element> which has only a getter
16
16
```
17
17
18
- 如果你使用 ` shallowMount ` 或 ` stubs ` ,并且使用了与 [ ` Element ` ] ( https://developer.mozilla.org/en-US/docs/Web/API/Element ) 共享的属性名称,将会显示此警告 。
18
+ 当您使用 ` shallowMount ` 或具有与 [ ` Element ` ] ( https://developer.mozilla.org/en-US/docs/Web/API/Element ) 共享的属性名称的 ` stubs ` 时,会显示此警告 。
19
19
20
20
与 ` Element ` 共享的常见属性名称:
21
+ * ` attributes `
22
+ * ` children `
23
+ * ` prefix `
21
24
22
- - ` attributes `
23
- - ` children `
24
- - ` prefix `
25
-
26
- 请参见:https://developer.mozilla.org/en-US/docs/Web/API/Element
25
+ 请参阅:https://developer.mozilla.org/zh-CN/docs/Web/API/Element
27
26
28
27
** 可能的解决方案**
29
28
30
- 1 . 使用 ` mount ` 而不是 ` shallowMount ` 来渲染而不使用桩
29
+ 1 . 使用 ` mount ` 而不是 ` shallowMount ` 进行不带存根的渲染
31
30
2 . 通过模拟 ` console.warn ` 来忽略警告
32
31
3 . 重命名 prop,以避免与 ` Element ` 属性冲突
You can’t perform that action at this time.
0 commit comments