2
0
mirror of https://github.com/tenrok/vue-meta.git synced 2026-06-18 09:50:33 +03:00

feat: support generating tags directly from metaInfo object

This commit is contained in:
pimlie
2019-07-28 16:13:58 +02:00
committed by Pim
parent 931c0c4e88
commit cb2758eb0f
17 changed files with 128 additions and 70 deletions
+7 -2
View File
@@ -1,6 +1,7 @@
import { clientSequences } from '../shared/escaping'
import { getComponentMetaInfo } from '../shared/getComponentOption'
import getMetaInfo from '../shared/getMetaInfo'
import { isFunction } from '../utils/is-type'
import { clientSequences } from '../shared/escaping'
import updateClientMetaInfo from './updateClientMetaInfo'
export default function _refresh (options = {}) {
@@ -15,10 +16,14 @@ export default function _refresh (options = {}) {
* @return {Object} - new meta info
*/
return function refresh () {
const metaInfo = getMetaInfo(options, this.$root, clientSequences)
// collect & aggregate all metaInfo $options
const rawInfo = getComponentMetaInfo(options, this.$root)
const metaInfo = getMetaInfo(options, rawInfo, clientSequences, this.$root)
const appId = this.$root._vueMeta.appId
const tags = updateClientMetaInfo(appId, options, metaInfo)
// emit "event" with new info
if (tags && isFunction(metaInfo.changed)) {
metaInfo.changed(metaInfo, tags.addedTags, tags.removedTags)