소스 검색

fix: query parameter on tags page (#4668)

anatawa12 3 년 전
부모
커밋
29f173c24c
1개의 변경된 파일16개의 추가작업 그리고 0개의 파일을 삭제
  1. 16 0
      client/components/tags.vue

+ 16 - 0
client/components/tags.vue

@@ -250,6 +250,22 @@ export default {
       [{name: this.$t('tags:localeAny'), code: 'any'}],
       (siteLangs.length > 0 ? siteLangs : [])
     )
+    if (this.$route.query.lang) {
+      this.locale = this.$route.query.lang
+    }
+    if (this.$route.query.sort) {
+      this.orderBy = this.$route.query.sort.toLowerCase()
+      switch (this.orderBy) {
+        case 'updatedat':
+          this.orderBy = 'updatedAt'
+          break
+      }
+      this.pagination.sortBy = [this.orderBy]
+    }
+    if (this.$route.query.dir) {
+      this.orderByDirection = this.$route.query.dir === 'asc' ? 0 : 1
+      this.pagination.sortDesc = [this.orderByDirection === 1]
+    }
   },
   methods: {
     toggleTag (tag) {