2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-22 15:10:34 +03:00

fix bug in htmlAttr handling causing missing attrs

This commit is contained in:
Declan de Wet
2016-10-31 07:52:20 +02:00
parent 017fde49e8
commit ac48085d38
5 changed files with 63 additions and 4 deletions
+5 -1
View File
@@ -1,3 +1,4 @@
import deepMerge from 'deepmerge'
import { VUE_META_ATTRIBUTE } from './constants'
// initialize vue-meta
@@ -69,11 +70,14 @@ VueMeta.install = function install (Vue) {
return {
toString () {
let attributeStr = ''
let watchedAttrs = []
for (let attr in data) {
if (data.hasOwnProperty(attr)) {
watchedAttrs.push(attr)
attributeStr += `${typeof data[attr] !== 'undefined' ? `${attr}="${data[attr]}"` : attr} `
}
}
attributeStr += `${VUE_META_ATTRIBUTE}="${watchedAttrs.join(',')}"`
return attributeStr.trim()
}
}
@@ -141,7 +145,7 @@ function getMetaInfoDefinition (Vue, $instance, metaInfo = {
}
// ...then merge the data into metaInfo
metaInfo = Vue.util.mergeOptions(metaInfo, componentMetaInfo)
metaInfo = deepMerge(metaInfo, componentMetaInfo)
}
// check if any children also have a metaInfo option, if so, merge