From 66a882a309c927736b340d2d273b5c40201fe946 Mon Sep 17 00:00:00 2001 From: weipengfei <2187978347@qq.com> Date: Wed, 27 Mar 2024 13:48:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=B5=84=E8=AE=AF=E6=9D=BF?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/recommend/index.vue | 96 ++++++++++++++++++++++++++++++---- pages.json | 6 ++- pages/news_details/index.vue | 3 +- pages/news_list/index.vue | 91 +++++++++++++++++++++++++------- 4 files changed, 164 insertions(+), 32 deletions(-) diff --git a/components/recommend/index.vue b/components/recommend/index.vue index 7a518e4..68efb0f 100644 --- a/components/recommend/index.vue +++ b/components/recommend/index.vue @@ -1,11 +1,11 @@ diff --git a/pages/news_list/index.vue b/pages/news_list/index.vue index c960cf3..58f6433 100644 --- a/pages/news_list/index.vue +++ b/pages/news_list/index.vue @@ -1,7 +1,7 @@ @@ -80,7 +90,7 @@ navList: [], active: 0, page: 1, - limit: 8, + limit: 20, status: false, scrollLeft: 0 }; @@ -92,11 +102,15 @@ /** * 生命周期函数--监听页面显示 */ - onLoad: function() { - this.getArticleCate(); - this.status = false; - this.page = 1; - this.articleList = []; + onLoad: function(options) { + this.status = false; + this.page = 1; + this.articleList = []; + if(options.type) { + this.active=options.type; + this.getCidArticle(); + } + else this.getArticleCate(); }, /** * 页面上拉触底事件的处理函数 @@ -154,14 +168,27 @@ this.status = false; this.getCidArticle(); } - } + }, + URLdate(date){ + // 创建一个 Date 对象来获取当前时间 + const currentDate = new Date(date); + + // 获取年、月、日 + const year = currentDate.getFullYear(); + const month = String(currentDate.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要加1并补零 + const day = String(currentDate.getDate()).padStart(2, '0'); + + // 格式化成 xxxx年xx月xx日 的格式 + const formattedDate = `${year}年${month}月${day}日`; + return formattedDate; + } } }