post-detail.js:
var postsData = require('../../../data/potos-data.js')
Page({
data: {},
onLoad: function (option) {
var postId = option.id;
var postData = postsData.postsList[postId];
this.setData({
postData: postData
})
},
post.js:
var postsData = require('../../data/potos-data.js');
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
potos_key: postsData.postsList,
});
},
potos-data.js:
module.exports = {
postsList: local_database
}
提示:
Setting data field "postData" to undefined is invalid.