vue中meta的用法

655Z技术栈 VUE 2025年07月30日 10

vue-meta 主要用于管理 HMTL 头部标签,同时也支持 SSR。基本用法,在main.js中使用:vue中meta主要用于管理HMTL头部标签,能够支持SSR,基本用法如下:

//在main.js中使用

import Meta from 'vue-meta';

Vue.use(Meta)

new Vue({

router,

data:{

title: 'How to use vue-meta',

keywords:'vue,vue-router,vue-meta',

description:'this is a des info.'

},

//定义metaInfo

metaInfo(){

return(){

title: this.title,

meta:[

{

name:'keywords',

content:this.keywords

},{

name:"description",

content:this.description

}

]

}

},

render: h=>(APP)

}).$mount('#app')

提供PHP及ThinkPHP框架的定制开发、代码优化,PHP修改、ThinkPHP修改。

邮箱:yvsm@163.com 微信:yvsm316 QQ:316430983
关闭

用微信“扫一扫”