对不起是在下沙雕了,更简单的方法直接见最下。
需求:修改框中的信息

一、在main.js中:
// 设置浏览器标题
Vue.directive('title', {
inserted: function (el, binding) {
document.title = el.dataset.title
}
})
二、在某个页面最大的div上:

加上以下代码:
v-title data-title="测试title"
效果:

////////////////////////////////////更简单的方法,一行代码,在页面中直接赋值给document.title

网友评论