国际化动态标题赋值
添加标题
<template>
<el-container>
<title>{{$t('common.category')}}</title>
</el-container>
</template>
首先监听语言改变
watch: {
'$i18n.locale' (newVal, oldVal) {
document.title = this.$t('common.category')
}
},
标题动态数据赋值
<template>
<el-container>
<title></title>
</el-container>
</template>
然后每次请求完数据后直接赋值(这里的数据自己调整)
document.title = res['list'][0].fields.title;