From 8c43f47d6412e5a5e67f16b9cd6cb15f7b7d8395 Mon Sep 17 00:00:00 2001 From: Declan de Wet Date: Sun, 30 Oct 2016 09:43:44 +0200 Subject: [PATCH] support title template --- index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 938430c..d5f16fe 100644 --- a/index.js +++ b/index.js @@ -32,6 +32,7 @@ // define API methods on the `$vueMeta` instance property Object.defineProperty(Vue.prototype, '$vueMeta', { enumerable: true, + /** * Meta info manager API factory * @return {Object} - the API for this plugin @@ -59,7 +60,11 @@ * @return {Object} - all the meta info for currently matched components */ function getMetaInfo () { - return getMetaInfoDefinition(Vue, this) + var info = getMetaInfoDefinition(Vue, this) + if (info.titleTemplate) { + info.title = info.titleTemplate.replace('%s', info.title) + } + return info } } @@ -111,6 +116,7 @@ } } + // meta info is ready for consumption return metaInfo }