Show asset name in the app header
Signed-off-by: Sukanya Pandey <sukapan1@in.ibm.com>
Change-Id: If5394604d6c91b3604eaadb33178376fe6da672c
diff --git a/src/App.vue b/src/App.vue
index f6991c4..fc04b70 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -7,9 +7,22 @@
<script>
export default {
name: 'App',
+ computed: {
+ assetTag() {
+ return this.$store.getters['global/assetTag'];
+ },
+ },
watch: {
+ assetTag: function (tag) {
+ if (tag) {
+ document.title = `${tag} - ${this.$route.meta.title}`;
+ }
+ },
$route: function (to) {
document.title = to.meta.title || 'Page is missing title';
+ if (this.assetTag) {
+ document.title = `${this.assetTag} - ${to.meta.title}`;
+ }
},
},
created() {