# vue-titles

> A Vue based Title plug-in

Latest version **1.1.0** (published 2019-07-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-titles
pnpm add vue-titles
yarn add vue-titles
bun add vue-titles
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2019-07-24 |
| First published | 2018-05-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | qiaojianfeng |
| Maintainers | qiaojianfeng |
| Keywords | vue, title |

## Links

- npm: https://www.npmjs.com/package/vue-titles
- Repository: https://github.com/webweifeng/vue-titles
- Homepage: https://github.com/webweifeng/vue-titles#readme
- Issues: https://github.com/webweifeng/vue-titles/issues
- npm.io page: https://npm.io/package/vue-titles

## Recent versions

- 1.1.0 (latest) — 2019-07-24
- 1.0.4 — 2018-05-12
- 1.0.2 — 2018-05-12
- 1.0.0 — 2018-05-12

## README

### 作用

Vuejs 单页应用在 iOS 系统下部分 APP 的 webview 中 标题不能通过 document.title = xxx 的方式修改
该插件只为解决该问题而生(兼容安卓)

> 参考来源：vue-wechart-title
> `去掉favicon，精简完善版本`

### 安装

> Vuejs 2.x

```bash
npm install vue-titles --save
```

##### ES6

> main.js

```js
Vue.use(require('vue-titles'));
```

> 路由定义(只截取一部分)

```js
// ...
const routes = [
  {
    name: 'Home',
    path: '/home',
    meta: {
      title: '首页'
    },
    component: require('../views/Home.vue')
  },
  {
    name: 'Order',
    path: '/order',
    meta: {
      title: '订单'
    },
    component: require('../views/Order.vue')
  },
  {
    name: 'UCenter',
    path: '/ucenter',
    meta: {
      title: '用户中心'
    },
    component: require('../views/UCenter.vue')
  }
];
// ...
```

> App.vue **建议全局只使用一次该指令 标题可用 vuex 或者 router 中定义 不要多处使用!!**

```html
<!-- 任意元素中加 v-title 指令 建议将标题放在 route 对应meta对象的定义中 -->
<div v-title="$route.meta.title"></div>
<!--or-->
<router-view v-title="$route.meta.title"></router-view>

<!--自定义标题设置-->
<script>
  this.$setTitle('厉害了我的哥！');
</script>
```

### 欢迎提交 PR

---
_Source: https://npm.io/package/vue-titles · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
