
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
vue-document-title-plugin
Advanced tools
支持vue-router(version >= 2.0)导航切换更改document.title
<script src="https://unpkg.com/vue-document-title-plugin/dist/vue-document-title-plugin.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>
<script src="https://unpkg.com/vue-document-title-plugin/dist/vue-document-title-plugin.min.js"></script>
</head>
<body>
<div id="app">
<button @click="change">change title</button>
<button @click="get">get title</button>
<router-view></router-view>
</div>
<template id="index">
<div>
<h1>this is index page</h1>
<router-link to="/list">go to list</router-link>
</div>
</template>
<template id="list">
<div>
<h1>this is list page</h1>
<router-link to="/">go to index</router-link>
</div>
</template>
<script>
Vue.use(VueRouter);
var router = new VueRouter({
routes: [{
path: "/",
component: { template: "#index" },
meta: { title: "首页" }
}, {
path: "/list",
component: { template: "#list" },
meta: { title: "列表页" }
}]
});
Vue.use(vueDocumentTitlePlugin, router, { filter: function (title) { return title + "[balabala]" } });
new Vue({
el: "#app",
router,
methods: {
change: function () {
this.$doc.title = "xxxx";
},
get: function () {
alert(this.$doc.title);
}
}
})
</script>
</body>
</html>
$ npm install vue-document-title-plugin --save # Or
$ yarn add vue-document-title-plugin
// main.js
import Vue from "vue";
import VueRouter from "vue-router";
import VueDocumentTitlePlugin from "vue-document-title-plugin";
Vue.use(VueRouter);
const router = new VueRouter({
routes: [{
path: "/",
// component:
meta: { title: "首页" } // 导航到这个路由document.title会变成 首页【网站名称】
}]
});
Vue.use(VueDocumentTitlePlugin, router, { defTitle: "【网站名称】", filter: title => `${title}【网站名称】` });
FAQs
vue-router plugin
We found that vue-document-title-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.