diff --git a/新闻小程序/pages/news-detail/news-detail.js b/新闻小程序/pages/news-detail/news-detail.js index 3923538..cd81e55 100644 --- a/新闻小程序/pages/news-detail/news-detail.js +++ b/新闻小程序/pages/news-detail/news-detail.js @@ -1,4 +1,5 @@ // pages/news-detail/news-detail.js +let newsType = ''; Page({ /** @@ -12,8 +13,13 @@ Page({ */ onLoad: function (options) { // console.log('从主页传递来的id:', options.id) - // console.log('从主页传递来的newsType:', options.newsType) - let newsType = options.newsType + // console.log('从主页传递来的currentIndex:', options.currentIndex) + let currentIndex = options.currentIndex + if (currentIndex == 0) {newsType='nd-news'} + else if (currentIndex == 1) {newsType='xg-news'} + else if (currentIndex == 2) {newsType='tw-news'} + else if (currentIndex == 3) {newsType='gj-news'} + else if (currentIndex == 4) {newsType='junshi-news'} wx.cloud.database().collection(newsType).doc(options.id) .get() .then(res => {