Home> Web Front-end> Vue.js> body text

How to add a title in vue

青灯夜游
Release: 2021-10-27 12:04:40
Original
4686 people have browsed it

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 } })
Copy after login
# in the main.js file ##Step 2: Add

Copy after login
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!

Related labels:
source:php.cn
Statement of this Website
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