上传文件至 '新闻小程序/pages/news-detail'

新闻详情页
This commit is contained in:
link_1999 2022-04-04 21:45:20 +08:00
parent d74240d2ec
commit 972eca5870
4 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1,74 @@
// pages/news-detail/news-detail.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log('从主页传递来的id:', options.id)
wx.cloud.database().collection('neidi-news').doc(options.id)
.get()
.then(res => {
console.log('请求成功', res)
this.setData({
detail: res.data,
news_image: res.data.news_img,
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,9 @@
<view>
<view>{{detail.news_title}}</view>
<view>{{detail.news_date}}</view>
<view>{{detail.news_author}}</view>
<view wx:if="{{news_image}}">
<image src="{{news_image}}"></image>
</view>
<view>{{detail.news_content}}</view>
</view>

View File

@ -0,0 +1 @@
/* pages/news-detail/news-detail.wxss */