上传文件至 '新闻小程序/pages/news-detail'
改进新闻详情页的跳转(新增:判断对应板块新闻应该查找那个数据库集合)
This commit is contained in:
parent
afcb73a2a4
commit
ac13b040bf
|
@ -11,8 +11,10 @@ Page({
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad: function (options) {
|
onLoad: function (options) {
|
||||||
console.log('从主页传递来的id:', options.id)
|
// console.log('从主页传递来的id:', options.id)
|
||||||
wx.cloud.database().collection('neidi-news').doc(options.id)
|
// console.log('从主页传递来的newsType:', options.newsType)
|
||||||
|
let newsType = options.newsType
|
||||||
|
wx.cloud.database().collection(newsType).doc(options.id)
|
||||||
.get()
|
.get()
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log('请求成功', res)
|
console.log('请求成功', res)
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<view wx:if="{{news_image}}">
|
<view wx:if="{{news_image != 'None'}}">
|
||||||
<image class="news_image" src="{{news_image}}"></image>
|
<image class="news_image" src="{{news_image}}"></image>
|
||||||
</view>
|
</view>
|
||||||
<rich-text class="news_content">{{detail.news_content}}</rich-text>
|
<rich-text class="news_content">{{detail.news_content}}</rich-text>
|
Loading…
Reference in New Issue