@@ -31,7 +31,6 @@ Anthony Fu
3131 </div >
3232</div >
3333
34-
3534---
3635layout: 'intro'
3736---
@@ -55,7 +54,6 @@ A fanatical full-time open sourceror.<br>
5554
5655<img src =" https://antfu.me/avatar.png " class =" rounded-full w-40 abs-tr mt-16 mr-12 " alt =" A comic art image of Anthony Fu " />
5756
58-
5957---
6058name: Sponsors
6159layout: center
@@ -74,7 +72,6 @@ layout: center
7472
7573# Composable Vue
7674
77-
7875---
7976name: VueUse
8077layout: center
@@ -106,7 +103,6 @@ layout: center
106103 </div >
107104</div >
108105
109-
110106---
111107layout: center
112108class: text-center
@@ -116,7 +112,6 @@ class: text-center
116112
117113a brief go-through
118114
119-
120115---
121116
122117<div class =" grid grid-cols-2 gap-x-4 " ><div >
@@ -175,7 +170,6 @@ bar.prop = 1
175170</div >
176171</div ></div >
177172
178-
179173---
180174
181175# Ref Auto Unwrapping <MarkerCore />
@@ -224,7 +218,6 @@ data.foo // 'bar'
224218
225219</div >
226220
227-
228221---
229222
230223# ` unref ` - Opposite of Ref <MarkerCore />
@@ -260,7 +253,6 @@ unref(bar) // 'bar'
260253
261254</div ></div >
262255
263-
264256---
265257layout: center
266258class: text-center
@@ -270,7 +262,6 @@ class: text-center
270262
271263of writing composable functions
272264
273-
274265---
275266
276267# What's Composable Functions
@@ -309,7 +300,6 @@ export function useDark(options: UseDarkOptions = {}) {
309300<VueUse name =" useDark " />
310301</div >
311302
312-
313303---
314304
315305# Think as "Connections"
@@ -327,7 +317,6 @@ The `setup()` only runs **once** on component initialization, to construct the r
327317 </div >
328318</div >
329319
330-
331320---
332321
333322# One Thing at a Time
@@ -340,7 +329,6 @@ Just the same as authoring JavaScript functions.
340329- Keep function small and simple
341330- "Do one thing, and do it well"
342331
343-
344332---
345333
346334# Passing Refs as Arguments <MarkerPattern />
@@ -359,7 +347,6 @@ Just the same as authoring JavaScript functions.
359347Plain function
360348</div >
361349
362-
363350``` ts
364351function add(a : number , b : number ) {
365352 return a + b
@@ -416,7 +403,6 @@ c.value // 6
416403
417404</div >
418405
419-
420406---
421407
422408# MaybeRef <MarkerTips />
@@ -431,7 +417,6 @@ type MaybeRef<T> = Ref<T> | T
431417
432418In VueUse, we use this helper heavily to support optional reactive arguments
433419
434-
435420` ` ` ts
436421export function useTimeAgo(
437422 time : Date | number | string | Ref <Date | number | string >,
@@ -455,7 +440,6 @@ export function useTimeAgo(
455440
456441</v-click >
457442
458-
459443---
460444
461445# Make it Flexible <MarkerPattern />
@@ -501,7 +485,6 @@ name.value = 'Hi' // Hi - World
501485<VueUse name =" useTitle " />
502486</div >
503487
504-
505488---
506489
507490# ` useTitle ` <Marker class =" text-blue-400 " >Case</Marker >
@@ -531,11 +514,6 @@ export function useTitle(
531514
532515``` html
533516
534-
535-
536-
537-
538-
539517<-- 1. use the user provided ref or create a new one
540518
541519<-- 2. sync ref changes to the document title
@@ -545,7 +523,6 @@ export function useTitle(
545523</v-clicks >
546524</div >
547525
548-
549526---
550527
551528# "Reuse" Ref <MarkerCore />
@@ -561,7 +538,6 @@ const bar = ref(foo) // Ref<1>
561538foo === bar // true
562539```
563540
564-
565541``` ts
566542function useFoo(foo : Ref <string > | string ) {
567543 // no need!
@@ -578,7 +554,6 @@ Extremely useful in composable functions that take uncertain argument types.
578554
579555</v-clicks >
580556
581-
582557---
583558
584559# ` ref ` / ` unref ` <MarkerTips />
@@ -602,7 +577,6 @@ function useBala<T>(arg: MaybeRef<T>) {
602577
603578</div >
604579
605-
606580---
607581
608582# Object of Refs <MarkerPattern />
@@ -639,7 +613,6 @@ mouse.x === x.value // true
639613</v-clicks >
640614</div >
641615
642-
643616---
644617
645618# Async to "Sync" <MarkerTips />
@@ -674,7 +647,6 @@ Establish the "Connections" first, then wait for data to be filled up. The idea
674647
675648</div >
676649
677-
678650---
679651
680652# ` useFetch ` <Marker class =" text-blue-400 " >Case</Marker >
@@ -704,7 +676,6 @@ export function useFetch<R>(url: MaybeRef<string>) {
704676<VueUse name =" useFetch " />
705677</div >
706678
707-
708679---
709680
710681# Side-effects Self Cleanup <MarkerPattern />
@@ -758,7 +729,6 @@ const scope = effectScope(() => {
758729stop (scope )
759730```
760731
761-
762732---
763733disabled: true
764734---
@@ -793,7 +763,6 @@ export default defineComponent({
793763
794764</div >
795765
796-
797766---
798767disabled: true
799768---
@@ -827,7 +796,6 @@ export default defineComponent({
827796</v-click >
828797</div >
829798
830-
831799---
832800
833801# Typed Provide / Inject <MarkerCore />
@@ -850,7 +818,6 @@ export const injectKeyUser: InjectionKey<UserInfo> = Symbol('user')
850818
851819</div >
852820
853-
854821---
855822
856823# Typed Provide / Inject <MarkerCore />
@@ -894,7 +861,6 @@ export default {
894861</v-clicks >
895862</div >
896863
897-
898864---
899865
900866# Shared State <MarkerPattern />
@@ -940,7 +906,6 @@ console.log(state.foo) // 2
940906
941907<h3 v-click class =" opacity-100 " >⚠️ But it's not SSR compatible!</h3 >
942908
943-
944909---
945910
946911# Shared State (SSR friendly) <MarkerPattern />
@@ -1001,7 +966,6 @@ const state = useMyState()
1001966
1002967</div >
1003968
1004-
1005969---
1006970
1007971# useVModel <MarkerTips />
@@ -1061,7 +1025,6 @@ export default defineComponent({
10611025<VueUse name =" useVModel " />
10621026</div >
10631027
1064-
10651028---
10661029disabled: true
10671030---
@@ -1093,14 +1056,12 @@ export function usePassiveVModel(props, name) {
10931056
10941057</v-click >
10951058
1096-
10971059---
10981060layout: center
10991061---
11001062
11011063# All of them work for both Vue 2 and 3
11021064
1103-
11041065---
11051066
11061067# ` @vue/composition-api ` <Marker class =" text-teal-400 " >Lib</Marker >
@@ -1118,7 +1079,6 @@ Vue.use(VueCompositionAPI)
11181079import { reactive , ref } from ' @vue/composition-api'
11191080```
11201081
1121-
11221082---
11231083
11241084# Vue 2.7 <Marker class =" text-purple-400 " >Upcoming</Marker >
@@ -1131,7 +1091,6 @@ import { reactive, ref } from '@vue/composition-api'
11311091- IE11 support.
11321092- LTS.
11331093
1134-
11351094---
11361095
11371096# Vue Demi <Marker class =" text-teal-400 " >Lib</Marker >
@@ -1145,7 +1104,6 @@ import { defineComponent, reactive, ref } from 'vue-demi'
11451104
11461105<img class =" h-50 mx-auto " src =" https://cdn.jsdelivr.net/gh/vueuse/vue-demi/assets/banner.png " alt =" " />
11471106
1148-
11491107---
11501108
11511109# Recap
@@ -1159,7 +1117,6 @@ import { defineComponent, reactive, ref } from 'vue-demi'
11591117- Side-effect self clean up
11601118- Shared state
11611119
1162-
11631120---
11641121layout: center
11651122class: 'text-center pb-5 :'
0 commit comments