npm i vue-meta-info --save
import MetaInfo from ‘vue-meta-info‘;
<template>
...
</template>
<script>
export default {
metaInfo: {
title: ‘My Example App‘, // set a title
meta: [{ // set meta
name: ‘keyWords‘,
content: ‘My Example App‘
}]
link: [{ // set link
rel: ‘asstes‘,
href: ‘https://assets-cdn.github.com/‘
}]
}
}
</script>
<template>
...
</template>
<script>
export default {
name: ‘async‘,
metaInfo () {
return {
title: this.pageName
}
},
data () {
return {
pageName: ‘loading‘
}
},
mounted () {
setTimeout(() => {
this.pageName = ‘async‘
}, 2000)
}
}
</script>
原文:https://www.cnblogs.com/magic-world/p/13906434.html