12345678910111213141516171819202122232425262728293031323334 |
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- noticeDetail: {}
- },
- onLoad: function (options) {
- const app = getApp();
- // 如果传入了完整的通知数据,则直接使用
- if (options.noticeData) {
- this.setData({
- noticeDetail: JSON.parse(decodeURIComponent(options.noticeData))
- });
- return;
- }
-
- // 如果只传入了id,则从全局notices中获取
- if (options.id) {
- const noticeDetail = app.globalData.notices.find(notice => notice.id === options.id);
- this.setData({
- noticeDetail
- });
- }
- },
- /**
- * 返回上一页
- */
- goBack: function() {
- wx.navigateBack();
- },
- })
|