Skip to content
On this page

useTitle

用于管理页面标题的 Hook。

Demo

<template>
<Demo2 v-if="show" />
<button @click="toggle">destroy demo2</button>
</template>

<script setup lang="ts">
import { useBoolean } from 'v3-use'
import Demo2 from './demo2.vue'

const [show, { toggle }] = useBoolean(true)
</script>

Usage

import { useTitle } from 'v3-use'
const [title, setTitle] = useTitle()
import { useTitle } from 'v3-use'
const [title, setTitle] = useTitle()

Reference

Type Declarations

export interface Options {
  restoreOnUnmount: boolean
}
export declare function useTitle(
  title?: string,
  options?: Options
): [Ref<string>, (value: string | ((c: string) => string)) => void]
export interface Options {
  restoreOnUnmount: boolean
}
export declare function useTitle(
  title?: string,
  options?: Options
): [Ref<string>, (value: string | ((c: string) => string)) => void]