小程序開發問題

數據內容換行:php

1. 必須在text標籤內
2. \n換行,\rEnter, \t空格

 導航頁面跳轉傳參:小程序

方法:經過Page中的onLoad自動接收參數
<view class="btn-area"> <navigator url="/page/navigate/navigate?title=navigate" hover-class="navigator-hover">跳轉到新頁面</navigator> <navigator url="../../redirect/redirect/redirect?title=redirect" open-type="redirect" hover-class="other-navigator-hover">在當前頁打開</navigator> <navigator url="/page/index/index" open-type="switchTab" hover-class="other-navigator-hover">切換 Tab</navigator> </view> Page({ onLoad: function(options) { this.setData({ title: options.title }) } })

wx.request裏的this不指向外部:安全

onLoad (options) {
    let that = this
    wx.request({
      url: app.config.host + '/weiphp/index.php?s=/w16/Cms/Cms/getDetail',
      data: {id: options.id},
      success (res) {
        that.setData({info: res.data})
        // console.log(res.data)
      }
    })
  }

域名問題:微信

1. 使用安全域:
必須爲被認證的已備案的域名,在小程序後臺中設置

2. 使用非安全域:
開發階段可使用未校驗的域名訪問方式,在微信開發者工具中進行設置
相關文章
相關標籤/搜索