2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-08 02:52:24 +03:00

Merge pull request #126 from wilk/patch-4

added headAttrs
This commit is contained in:
Sébastien Chopin
2017-08-15 10:22:16 +02:00
committed by GitHub
4 changed files with 9 additions and 2 deletions
+6 -1
View File
@@ -26,8 +26,13 @@ export default function _updateClientMetaInfo (options = {}) {
break
// update attributes
case 'htmlAttrs':
updateTagAttributes(options)(newInfo[key], htmlTag)
break
case 'bodyAttrs':
updateTagAttributes(options)(newInfo[key], key === 'htmlAttrs' ? htmlTag : document.getElementsByTagName('body')[0])
updateTagAttributes(options)(newInfo[key], document.getElementsByTagName('body')[0])
break
case 'headAttrs':
updateTagAttributes(options)(newInfo[key], document.getElementsByTagName('head')[0])
break
// ignore these
case 'titleChunk':
+1
View File
@@ -16,6 +16,7 @@ export default function _generateServerInjector (options = {}) {
return titleGenerator(options)(type, data)
case 'htmlAttrs':
case 'bodyAttrs':
case 'headAttrs':
return attrsGenerator(options)(type, data)
default:
return tagGenerator(options)(type, data)
+1 -1
View File
@@ -4,7 +4,7 @@ export default function _attrsGenerator (options = {}) {
/**
* Generates tag attributes for use on the server.
*
* @param {('bodyAttrs'|'htmlAttrs')} type - the type of attributes to generate
* @param {('bodyAttrs'|'htmlAttrs'|'headAttrs')} type - the type of attributes to generate
* @param {Object} data - the attributes to generate
* @return {Object} - the attribute generator
*/
+1
View File
@@ -36,6 +36,7 @@ export default function _getMetaInfo (options = {}) {
titleTemplate: '%s',
htmlAttrs: {},
bodyAttrs: {},
headAttrs: {},
meta: [],
base: [],
link: [],