Bläddra i källkod

Change route structure

sbkwgh 8 år sedan
förälder
incheckning
574dd7f992
2 ändrade filer med 5 tillägg och 5 borttagningar
  1. 3 3
      src/components/routes/Index.vue
  2. 2 2
      src/main.js

+ 3 - 3
src/components/routes/Index.vue

@@ -152,15 +152,15 @@
 		},
 		watch: {
 			selectedCategory (newValue) {
-				this.$router.push('/' + newValue.toLowerCase());
+				this.$router.push('/category/' + newValue.toLowerCase());
 			},
 			$route () {
-				this.selectedCategory = this.$route.path.split('/')[1].toUpperCase()
+				this.selectedCategory = this.$route.path.split('/')[2].toUpperCase()
 				this.getThreads()
 			}
 		},
 		created () {
-			this.selectedCategory = this.$route.path.split('/')[1].toUpperCase()
+			this.selectedCategory = this.$route.path.split('/')[2].toUpperCase()
 			this.getThreads()
 		}
 	}

+ 2 - 2
src/main.js

@@ -32,8 +32,8 @@ Vue.use(VueAxios, axios)
 
 const router = new VueRouter({
 	routes: [
-		{ path: '/', redirect: '/all' },
-		{ path: '/:category', component: Index },
+		{ path: '/', redirect: '/category/all' },
+		{ path: '/category/:category', component: Index },
 		{ path: '/start', component: Start },
 		{ path: '/thread/:slug/:id', component: Thread },
 		{ path: '/thread/:slug/:id/:post_id', component: Thread },