phpjavac / composition

vue3 compositionApis
https://phpjavac.github.io/composition/
12 stars 11 forks source link

[feat]: add useTitle #43

Closed gthdweb closed 3 years ago

gthdweb commented 3 years ago

使用场景

import { useTitle } from 'zcomposition'

const title = useTitle() console.log(title.value) // print current title title.value = 'Hello' // change current title

类型

新钩子 (之前没有,新加的功能)

参数、回调或其他补充

import { useTitle } from 'zcomposition'

const messages = ref(0)

const title = computed(() => { return !messages.value ? 'No message' : ${messages.value} new messages })

useTitle(title)