mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-09 04:32:25 +03:00
feat: dedupe local meta object by VMID
This commit is contained in:
Generated
+10
@@ -6559,6 +6559,16 @@
|
||||
"integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=",
|
||||
"dev": true
|
||||
},
|
||||
"lodash.uniqby": {
|
||||
"version": "4.7.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz",
|
||||
"integrity": "sha1-2ZwHpmnp5tJOE2Lf4mbGdhavEwI="
|
||||
},
|
||||
"lodash.uniqueid": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.uniqueid/-/lodash.uniqueid-4.0.1.tgz",
|
||||
"integrity": "sha1-MmjyanyI5PSxdY1nknGBTjH6WyY="
|
||||
},
|
||||
"log-symbols": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz",
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
"dependencies": {
|
||||
"deepmerge": "^2.2.1",
|
||||
"lodash.isplainobject": "^4.0.6",
|
||||
"lodash.uniqby": "^4.7.0",
|
||||
"lodash.uniqueid": "^4.0.1",
|
||||
"object-assign": "^4.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import deepmerge from 'deepmerge'
|
||||
import uniqBy from 'lodash.uniqby'
|
||||
import uniqueId from 'lodash.uniqueid'
|
||||
|
||||
/**
|
||||
* Returns the `opts.option` $option value of the given `opts.component`.
|
||||
@@ -15,7 +17,7 @@ import deepmerge from 'deepmerge'
|
||||
* @return {Object} result - final aggregated result
|
||||
*/
|
||||
export default function getComponentOption (opts, result = {}) {
|
||||
const { component, option, deep, arrayMerge, metaTemplateKeyName, contentKeyName } = opts
|
||||
const { component, option, deep, arrayMerge, metaTemplateKeyName, tagIDKeyName, contentKeyName } = opts
|
||||
const { $options } = component
|
||||
|
||||
if (component._inactive) return result
|
||||
@@ -64,6 +66,10 @@ export default function getComponentOption (opts, result = {}) {
|
||||
|
||||
return metaObject
|
||||
})
|
||||
result.meta = uniqBy(
|
||||
result.meta.reverse(),
|
||||
metaObject => metaObject.hasOwnProperty(tagIDKeyName) ? metaObject[tagIDKeyName] : uniqueId()
|
||||
)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ export default function _getMetaInfo (options = {}) {
|
||||
option: keyName,
|
||||
deep: true,
|
||||
metaTemplateKeyName,
|
||||
tagIDKeyName,
|
||||
contentKeyName,
|
||||
arrayMerge (target, source) {
|
||||
// we concat the arrays without merging objects contained in,
|
||||
|
||||
Reference in New Issue
Block a user