js點擊事件 都是 οnclick="事件名()"
但是微信小程序的點擊事件是用bindtap綁定
<button formType="button" class="search_btn" bindtap='search'>搜索</button>
js代碼
//index.js const app = getApp() Page({ /** * 頁面的初始數據 */ data: { }, /** * 生命周期函數--監聽頁面加載 */ onLoad: function (options) { }, /** * 生命周期函數--監聽頁面初次渲染完成 */ onReady: function () { }, /** * 生命周期函數--監聽頁面顯示 */ onShow: function () { }, // 點擊事件 search: function (e) { console.log("eeee"); }, })