这是我的代码:
search.wxml
:
<view class="search">
<view class="section">
<input id="input-word" placeholder="请输入您要查询的文本" focus/>
<view id="cancel-button" bindTap="navigateBack" class="navigator" >取消</view>
</view>
</view>
search.js
:
Page({
onLoad: function () {
console.log('onLoad-search')
},
// back
navigateBack: function(e) {
console.log("back"); // this do not log out, when I click my view
}
})
答案 0 :(得分:1)
函数“navigateBack”的位置是错误的。你应该这样说:
navigateBack: function(e) { console.log("back"); // this do not log out, when I click my view } onload: function() { console.log('onLoad-search') }