Luminous takes you into the field of WeChat small program development (19)

Luminous Prologue:

 

The roof tiles on rainy days, the wet and flowing streamers, are faint and gentle, the light is twilight, and the backlight is dim.

 

 

 

 
 
Text:
 
                                              Recognize the Tao with the Tao

Because our data was obtained later

So it should be written like this

object

Let's take a look at the complete code flow

var initData = [
   {
       "newsId":0,
       "authorIcon": "../images/3.png",
       "authorName":"GeniusTeam"
   }
]

module.exports = {
  initData: initData
}

 

// pages/news/news.js

var newsData = require("../data/newsdata.js")

Page({

  /**
   * 页面的初始数据
   */
  data: {
    indicatorDots:"true",
    indicatorColor:"pink"
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    // console.log(newsData);

    //这里要注意下
    //this.setData可以让view重绘
    this.setData({
      userData: newsData.initData
    })
  },

})

 

 

 

 

 

 

 

 

 

 

Published 1529 original articles · praised 305 · 180,000 views +

Guess you like

Origin blog.csdn.net/weixin_41987706/article/details/104766611