Home>Article>Web Front-end> How to add a title in vue

How to add a title in vue

青灯夜游
青灯夜游 Original
2021-10-27 12:04:40 4698browse

How to add a title in vue: 1. Add the "document.title = el.dataset.title" statement in the "main.js" file; 2. Set "v-title data" in the label of the required component -title="Login"" attribute is enough.

How to add a title in vue

The operating environment of this tutorial: windows7 system, vue2.9.6 version, DELL G3 computer.

vue project adds the title that changes the browser tag title

Step one: add

// 设置浏览器标题 Vue.directive('title', { inserted: function (el, binding) { document.title = el.dataset.title } })
# in the main.js file ##Step 2: Add

to any location in the component. Done

Related recommendations: "

vue.js Tutorial"

The above is the detailed content of How to add a title in vue. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to add dom to vuejs Next article:How to add dom to vuejs