From 9cac63a5ac19c4cae1d3414b994376b067e7f04c Mon Sep 17 00:00:00 2001 From: Richard Williams Date: Mon, 11 Sep 2017 12:25:01 +0100 Subject: [PATCH 1/3] fix support for category and post links in menu before it was setting every menu type to be a page --- src/components/theme-header.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/theme-header.vue b/src/components/theme-header.vue index 3759739..897f1ad 100644 --- a/src/components/theme-header.vue +++ b/src/components/theme-header.vue @@ -23,7 +23,7 @@ @@ -75,6 +75,15 @@ export default { const array = url.split( '/' ); return array[ array.length - 2 ]; }, + getRouteType: function( object ) { + let type = 'page' + if (object === 'category') { + type = 'cat' + } else if (object === 'post') { + type = 'post' + } + return type + }, toggleMenu: function() { //console.log("Clicked" + this.isActive); this.isActive = ! this.isActive; From 9e4d4c06cad1267362c3f3add1349cfa7ca6ec1f Mon Sep 17 00:00:00 2001 From: Richard Williams Date: Mon, 11 Sep 2017 16:36:37 +0100 Subject: [PATCH 2/3] Update theme-header.vue add tag --- src/components/theme-header.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/theme-header.vue b/src/components/theme-header.vue index 897f1ad..780491b 100644 --- a/src/components/theme-header.vue +++ b/src/components/theme-header.vue @@ -81,6 +81,8 @@ export default { type = 'cat' } else if (object === 'post') { type = 'post' + } else if (object === 'tag') { + type = 'tag' } return type }, From 2ac8f6c1c45f7b6181d1f82e9aa5137f3f365750 Mon Sep 17 00:00:00 2001 From: Richard Williams Date: Wed, 20 Sep 2017 13:17:26 +0100 Subject: [PATCH 3/3] add watch for changes to the url param and then load new category posts on param change. Before, if you clicked from one category nav link to another category link - nothing would happen as the component was being reused but no watcher on the param change --- src/components/category.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/category.vue b/src/components/category.vue index cdee6c1..525c83d 100644 --- a/src/components/category.vue +++ b/src/components/category.vue @@ -54,6 +54,15 @@ export default { } }, + watch: { + '$route' (to, from) { + const vm = this + console.log('Category param has changed') + if (vm.$route.params.name) { + vm.getCatId(vm.$route.params.name) + } + } + }, data() { return {