vue document 调用接口动态设置head title keywords description
<head>
<title></title> <meta name="keywords" content=""> <meta name="description" content="">
</head>
let head = document.getElementsByTagName('head');
let meta = document.createElement('meta');
document.title = res.sql[0].archival_title
document.querySelector('meta[name="keywords"]').setAttribute('content', res.sql[0].en_keyword)
document.querySelector('meta[name="description"]').setAttribute('content', res.sql[0].en_description)
head[0].appendChild(meta)
参考博客:https://www.cnblogs.com/caoxueyang/p/13937533.html