[WeChat Mini Programs] the parameters passed by navigateTo cannot be used to call the backend API.

Page({
  //apps
  onLoad: function (options) {

    this.setData({
      articleId: options.article_id
    })

    let contentGroupID = 000000000000000
    let MyContentGroup = new wx.BaaS.ContentGroup(contentGroupID)
    
    MyContentGroup.getContent(articleId).then(res => {
      // success
      console.log(res.data)
    }, err => {
      // err
    })
  },
  //
  data: {

  }
})

error report:

thirdScriptError
articleId is not defined;at pages/apps/articles/articles page lifeCycleMethod onLoad function
ReferenceError: articleId is not defined

in fact, I have successfully obtained this articleId and can display it on the page. However, I now hope to use this number to check the content of this article, because this is the id of this article.

I don"t know what this is all about. Please take a look at it. Thank you!


cannot be used directly: articleId
but should go like this: this.data.articleId

Menu