Skip to content

Commit

Permalink
总结自定义hook函数(体会组合式api的好处)
Browse files Browse the repository at this point in the history
  • Loading branch information
Panyue-genkiyo committed Oct 13, 2021
1 parent 832db4a commit 5ad020c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,6 @@ npm run dev



## 9.自定义hook函数

- 什么是hook?—— 本质是一个函数,把setup函数中使用的Composition API进行了封装。

- 类似于vue2.x中的mixin。

- 自定义hook的优势: 复用代码, 让setup中的逻辑更清楚易懂。




Expand Down Expand Up @@ -362,3 +354,12 @@ npm run dev
- `updated` =======>`onUpdated`
- `beforeUnmount` ==>`onBeforeUnmount`
- `unmounted` =====>`onUnmounted`


## 9.自定义hook函数

- 什么是hook?—— 本质是一个函数,把setup函数中使用的Composition API进行了封装。

- 类似于vue2.x中的mixin。

- 自定义hook的优势: 复用代码, 让setup中的逻辑更清楚易懂。

0 comments on commit 5ad020c

Please sign in to comment.