Skip to content

Commit b74d844

Browse files
committedOct 14, 2021
总结vue3的新组件(Teleport,Suspense)
1 parent 6fa13fe commit b74d844

File tree

1 file changed

+32
-33
lines changed

1 file changed

+32
-33
lines changed
 

‎README.md

+32-33
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,38 @@ npm run dev
506506
<img src="https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/e5ac7e20d1784887a826f6360768a368~tplv-k3u1fbpfcp-watermark.image" style="zoom:50%;width:560px;left" />
507507
</div>
508508

509+
510+
511+
512+
513+
514+
515+
516+
517+
518+
519+
## 2.Composition API 的优势
520+
521+
我们可以更加优雅的组织我们的代码,函数。让相关功能的代码更加有序的组织在一起。
522+
523+
<div style="width:500px;height:340px;overflow:hidden;float:left">
524+
<img src="https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/bc0be8211fc54b6c941c036791ba4efe~tplv-k3u1fbpfcp-watermark.image"style="height:360px"/>
525+
</div>
526+
<div style="width:430px;height:340px;overflow:hidden;float:left">
527+
<img src="https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/6cc55165c0e34069a75fe36f8712eb80~tplv-k3u1fbpfcp-watermark.image"style="height:360px"/>
528+
</div>
529+
530+
531+
532+
533+
# 五、新的组件
534+
535+
## 1.Fragment
536+
537+
- 在Vue2中: 组件必须有一个根标签
538+
- 在Vue3中: 组件可以没有根标签, 内部会将多个标签包含在一个Fragment虚拟元素中
539+
- 好处: 减少标签层级, 减小内存占用
540+
509541
## 2.Teleport
510542

511543
- 什么是Teleport?—— `Teleport` 是一种能够将我们的<strong style="color:#DD5145">组件html结构</strong>移动到指定位置的技术。
@@ -554,39 +586,6 @@ npm run dev
554586

555587

556588

557-
558-
559-
560-
561-
562-
563-
564-
565-
## 2.Composition API 的优势
566-
567-
我们可以更加优雅的组织我们的代码,函数。让相关功能的代码更加有序的组织在一起。
568-
569-
<div style="width:500px;height:340px;overflow:hidden;float:left">
570-
<img src="https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/bc0be8211fc54b6c941c036791ba4efe~tplv-k3u1fbpfcp-watermark.image"style="height:360px"/>
571-
</div>
572-
<div style="width:430px;height:340px;overflow:hidden;float:left">
573-
<img src="https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/6cc55165c0e34069a75fe36f8712eb80~tplv-k3u1fbpfcp-watermark.image"style="height:360px"/>
574-
</div>
575-
576-
577-
578-
579-
# 五、新的组件
580-
581-
## 1.Fragment
582-
583-
- 在Vue2中: 组件必须有一个根标签
584-
- 在Vue3中: 组件可以没有根标签, 内部会将多个标签包含在一个Fragment虚拟元素中
585-
- 好处: 减少标签层级, 减小内存占用
586-
587-
588-
589-
590589
# 六、其他
591590

592591
## 1.全局API的转移

0 commit comments

Comments
 (0)
Please sign in to comment.