Skip to content

Commit 596b9c0

Browse files
committed
fix: fix typo
1 parent 0e9cc20 commit 596b9c0

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

demo/01-how-to-build-reactivity-data.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
effect()
2929

3030
setTimeout(() => {
31-
// 2 秒后修改响应式数据
31+
// 1 秒后修改响应式数据
3232
obj.text = 'Hello Vue3!'
3333
}, 1000)
3434
</script>

demo/26-counter-using-render-function-options.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
const { count, plus, minus } = props
4242
return h('div', { class: 'demo'}, [
4343
h('button', { onClick: minus }, '-1'),
44-
h('span', { class: 'count' }, count),
44+
h('span', { class: 'count' }, String(count)),
4545
h('button', { onClick: plus }, '+1')
4646
])
4747
}

slides.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ effect(function effectFn1() {
553553
})
554554
```
555555

556-
分析以上代码可知,当发生 effect 嵌套时,**内层副作用函数 effectFn2 的执行会覆盖掉 activeEffect 的值**,并且永远不会恢复到原来的值,这就是问题产生的元因
556+
分析以上代码可知,当发生 effect 嵌套时,**内层副作用函数 effectFn2 的执行会覆盖掉 activeEffect 的值**,并且永远不会恢复到原来的值,这就是问题产生的原因
557557

558558
那么,应该如何解决这个问题吗 ?
559559

@@ -604,8 +604,8 @@ console.log('结束了')
604604
现在假设我们期望输出的顺序如下:
605605
```js
606606
1
607-
2
608607
'结束了'
608+
2
609609
```
610610

611611
---
@@ -1958,7 +1958,7 @@ function createCodegenContext() {
19581958
function genCode(node, context) {
19591959
const { push, indent, deIndent } = context
19601960
const fnName = 'render'
1961-
const args = ['_ctx', 'config']
1961+
const args = ['_ctx']
19621962
const signature = args.join(', ')
19631963

19641964
push(`return `)
@@ -1968,7 +1968,7 @@ function genCode(node, context) {
19681968
push(`{`)
19691969
// 缩进
19701970
indent()
1971-
push(`const { h, _toDisplayString } = config`)
1971+
push(`const { h, _toDisplayString } = MiniVue`)
19721972
indent()
19731973
push(`return `)
19741974
genNode(node, context)
@@ -2590,6 +2590,16 @@ createApp({
25902590

25912591
</div>
25922592

2593+
---
2594+
2595+
## 总结
2596+
2597+
我们依次实现了 响应式系统和模板编译,然后结合这两者实现了简单的挂载和更新。
2598+
2599+
有了这些基础,我们就可以做一些有趣的事情了。比如写一个计数器的demo,它能做到响应式更新,而且只更新需要更新的部分。
2600+
2601+
到这里,可以说我们实现了一个乞丐版 `Vue`,不过它只能处理相对简单的场景,但是对理解 Vue3 内部的原理还是非常有帮助的。
2602+
25932603
---
25942604
layout: image
25952605
image: /mikoto-misaka.jpg

0 commit comments

Comments
 (0)