input 输入框 关键字查询,当input输入框为空时,显示设置refreshIconShow为show显示刷新按钮,当输入框有值时隐藏刷新按钮。在开发者工具调试未出现过问题。真机测试未报错程序正常运行,但在运维中心偶尔会监控到Cannot read property ‘setData’ of null。
代码://获取input信息 inpuKeyword:function(e){ var keyword = e.detail.value; keyword = keyword.replace(/(^\s+)|(\s+$)/g,""); if(keyword==""){ this.getTerminalList(); if(this.data.refreshIconShow == “hidden”){ this.setData({ refreshIconShow: “show” }); } }else{ if(this.data.refreshIconShow == “show”){ this.setData({ refreshIconShow: “hidden” }); } } this.data.keyword = keyword; },