2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-23 10:30:34 +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 break
// update attributes // update attributes
case 'htmlAttrs': case 'htmlAttrs':
updateTagAttributes(options)(newInfo[key], htmlTag)
break
case 'bodyAttrs': 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 break
// ignore these // ignore these
case 'titleChunk': case 'titleChunk':
+1
View File
@@ -16,6 +16,7 @@ export default function _generateServerInjector (options = {}) {
return titleGenerator(options)(type, data) return titleGenerator(options)(type, data)
case 'htmlAttrs': case 'htmlAttrs':
case 'bodyAttrs': case 'bodyAttrs':
case 'headAttrs':
return attrsGenerator(options)(type, data) return attrsGenerator(options)(type, data)
default: default:
return tagGenerator(options)(type, data) 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. * 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 * @param {Object} data - the attributes to generate
* @return {Object} - the attribute generator * @return {Object} - the attribute generator
*/ */
+1
View File
@@ -36,6 +36,7 @@ export default function _getMetaInfo (options = {}) {
titleTemplate: '%s', titleTemplate: '%s',
htmlAttrs: {}, htmlAttrs: {},
bodyAttrs: {}, bodyAttrs: {},
headAttrs: {},
meta: [], meta: [],
base: [], base: [],
link: [], link: [],