From 23849c1847138ff826f48b0d1b0aea728139b6fd Mon Sep 17 00:00:00 2001
From: link_1999 <1402246900@qq.com>
Date: Wed, 27 Apr 2022 18:29:47 +0800
Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?=
=?UTF-8?q?=20'=E6=96=B0=E9=97=BB=E5=B0=8F=E7=A8=8B=E5=BA=8F/pages/home'?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
新闻小程序/pages/home/home.js | 15 ++++++++++-----
新闻小程序/pages/home/home.wxml | 21 ++++++++++++++-------
新闻小程序/pages/home/home.wxss | 2 --
3 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/新闻小程序/pages/home/home.js b/新闻小程序/pages/home/home.js
index 230514d..d580b3b 100644
--- a/新闻小程序/pages/home/home.js
+++ b/新闻小程序/pages/home/home.js
@@ -15,7 +15,7 @@ Page({
},
onLoad: function (options) {
// 获取轮播图数据
- wx.cloud.database().collection('homepage').get()
+ wx.cloud.database().collection('lunbotu-news').get()
.then(res => {
// console.log('轮播图数据:', res)
this.setData({
@@ -25,6 +25,7 @@ Page({
.catch(res => {
console.log('获取失败', res)
})
+ // 获取新闻列表数据
this.getList(0)
},
// 获取新闻列表数据
@@ -161,10 +162,10 @@ Page({
})
}
},
+ // 1获取被点击的标题身上的索引
+ // 2给data中的currentIndex赋值就可以了
+ // 3根据不同的索引来渲染右侧的商品内容
handleItemTap(e) {
- // 1获取被点击的标题身上的索引
- // 2给data中的currentIndex赋值就可以了
- // 3根据不同的索引来渲染右侧的商品内容
this.setData({
news_list: []
})
@@ -175,9 +176,13 @@ Page({
selectIndex: index
})
},
+ lunboDetail(event) {
+ wx.navigateTo({
+ url: '/pages/news-detail/news-detail?id=' + event.currentTarget.dataset.id + '¤tIndex=' + 5,
+ })
+ },
// 点击事件-去往详情页
gotoDetail(event) {
- // console.log('用户点击的新闻id:', event.currentTarget.dataset.id)
wx.navigateTo({
url: '/pages/news-detail/news-detail?id=' + event.currentTarget.dataset.id + '¤tIndex=' + currentIndex,
})
diff --git a/新闻小程序/pages/home/home.wxml b/新闻小程序/pages/home/home.wxml
index 4ce6041..459e903 100644
--- a/新闻小程序/pages/home/home.wxml
+++ b/新闻小程序/pages/home/home.wxml
@@ -2,14 +2,17 @@
-
+
{{item.title}}
@@ -21,9 +24,13 @@
-
-
-
+
+
+
@@ -34,11 +41,11 @@
-
+
- {{item.news_title}}
+ {{item.news_title}}
diff --git a/新闻小程序/pages/home/home.wxss b/新闻小程序/pages/home/home.wxss
index fd5853c..a53e1e4 100644
--- a/新闻小程序/pages/home/home.wxss
+++ b/新闻小程序/pages/home/home.wxss
@@ -7,14 +7,12 @@
border-bottom-color: black;
background-color: snow;
}
-
.top_menu_item {
font-size: 18px;
width: rpx;
display: inline-block;
margin: 10rpx 20rpx;
}
-
/* 导航栏被选中后的样式 */
.active {
color: #2b4b6b;