2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-12 23:32:24 +03:00

add once keyword, not generage observe attribute for tag

This commit is contained in:
ye huping
2017-04-27 16:54:19 +08:00
parent 39fea55de9
commit 8866b7e8ce
+8 -2
View File
@@ -19,6 +19,7 @@ export default function _tagGenerator (options = {}) {
// these attributes are treated as children on the tag
case 'innerHTML':
case 'cssText':
case 'once':
return attrsStr
// these form the attribute list for this tag
@@ -35,10 +36,15 @@ export default function _tagGenerator (options = {}) {
// these tag types will have content inserted
const closed = ['noscript', 'script', 'style'].indexOf(type) === -1
// generate tag exactly without any other redundance attribute
const observeTag = tag.once
? ''
: `${attribute}="true" `
// the final string for this specific tag
return closed
? `${tagsStr}<${type} ${attribute}="true" ${attrs}/>`
: `${tagsStr}<${type} ${attribute}="true" ${attrs}>${content}</${type}>`
? `${tagsStr}<${type} ${observeTag}${attrs}/>`
: `${tagsStr}<${type} ${observeTag}${attrs}>${content}</${type}>`
}, '')
}
}