From e350297a44823bb92d2c253b181c5bfe5fa6e6d7 Mon Sep 17 00:00:00 2001 From: yutent Date: Thu, 9 Mar 2023 19:27:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 6 +++--- src/views/home.vue | 1 + src/views/request.vue | 24 +++++++++++++++++++----- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index f517397..e08360f 100644 --- a/package.json +++ b/package.json @@ -2,10 +2,10 @@ "name": "jscdn.ink", "type": "module", "scripts": { - "start": "vue-live dev", - "build": "vue-live build" + "start": "fite dev", + "build": "fite build" }, "devDependencies": { - "@bytedo/vue-live": "^0.1.4" + "fite": "^0.3.3" } } diff --git a/src/views/home.vue b/src/views/home.vue index ac73a84..c212c09 100644 --- a/src/views/home.vue +++ b/src/views/home.vue @@ -61,6 +61,7 @@ export default { mounted() { this.$store.searchShow = true + console.log(this.$route.query) } } diff --git a/src/views/request.vue b/src/views/request.vue index 0473339..b243dd5 100644 --- a/src/views/request.vue +++ b/src/views/request.vue @@ -15,7 +15,9 @@ - {{ it.id }} + + {{ it.id }} + {{ it.author }} {{ it.latest || '-' }} {{ it.latest ? it.sync_date : '-' }} @@ -54,6 +56,7 @@ class="pager" layout="prev,pages,next" red + @page-change="pageChanged" :total="total" :page="page" /> @@ -138,13 +141,24 @@ export default { this.$list = r.data.map( it => ((it.sync_date = new Date(it.sync_date).format('Y/m/d')), it) ) - this.list = this.$list.filter(it => - this.onlyShowWaited ? it.stat === 1 : true - ) - this.total = this.list.length + this.fetchPage() + this.total = this.$list.length }) }, + fetchPage() { + let start = (this.page - 1) * 20 + let end = start + 20 + this.list = this.$list + .filter(it => (this.onlyShowWaited ? it.stat === 1 : true)) + .slice(start, end) + }, + + pageChanged(ev) { + this.page = ev.detail + this.fetchPage() + }, + search() { let filter = this.filter.trim() let onlyShowWaited = this.onlyShowWaited