微信小程式問題

2021-08-30 17:32:04 字數 552 閱讀 4730

1.js中this物件

在一般的函式中:

bindfachange1: function (e) )

}this.setdata是正確的。

但當在函式中有個請求(wx.request)時:

formsubmit: function (e) )}})

}    

這樣會報錯誤:this.setdata is not a function.

解決方法就是 :在請求(wx.request)外面新增:var that=this;將success中的

this.setdata()

改為:that.setdata()

2.event事件物件

通過data-name=''來設定事件的引數達到傳遞引數的目的

注意這個data-name設定變數過後會將name全部變成小寫

微信小程式問題

一般情況下是權重的問題,可以在button的樣式class名前面再加一層父容器的樣式class wxml button wrap share button open type share button view wxss button wrap share button錯誤原因 一開始我只寫了.sh...

微信小程式 賦值問題

通常我們在頁面跳轉傳遞過來的引數要用到頁面渲染時或是請求介面回來的資料要用到頁面渲染時 page 生命週期函式 監聽頁面載入 onload function options 生命週期函式 監聽頁面初次渲染完成 onready function view class weui cells weui c...

微信小程式之 問題

1.如何定義全域性資料 2.如何實現 的復用 函式的復用 test.js test function module.exports other.js var common require test.js page 模板 template name odd view odd view template...