Skip to content

Commit

Permalink
feat: config vitepress
Browse files Browse the repository at this point in the history
  • Loading branch information
lmhcoding committed Sep 29, 2020
1 parent 6890f7e commit cc1a3a5
Showing 1 changed file with 9 additions and 51 deletions.
60 changes: 9 additions & 51 deletions docs/state/useTitle.md
@@ -1,62 +1,20 @@
# ``useTitle``
---

用于设置页面的标签页标题
Composition Function that sets title of the page

## API

```typescript
export declare function useTitle(
title: string,
restoreOnUnMount?: boolean
): (title: string) => void;
```

## Params

| 参数 | 说明 | 类型 | 默认值 |
| ---------------- | ------------------------ | ------- | ------ |
| title | 标签页标题 | string | |
| restoreOnUnMount | 组件卸载时是否恢复原标题 | boolean | false |

## Methods

该 Hook 返回以下函数:

| 函数签名 | 描述 |
| ------------------------ | ---------------- |
| (title: string) => void | 用于设置页面标题 |

## Example

<UseTitle/>


## Code
## Usage
---

```vue
<template>
<input v-model="title"/>
<button @click="updateTitle">更新标题</button>
</template>
<script>
import { useTitle } from 'composition-fn'
import { ref } from 'vue'
export default {
setup () {
const setTitle = useTitle('title', true)
const title = ref('title')
const updateTitle = () => {
setTitle(title.value)
}
return {
title,
updateTitle
}
import { useTitle } from 'composition-fn'
export default {
setup () {
// 返回值为 setTitle 函数可用来更新 title
useTitle('title')
}
}
}
</script>
<script>
```

0 comments on commit cc1a3a5

Please sign in to comment.