var _request = require('../../utils/request.js') Page({ data: { statusBarHeight:20, navBarHeight:45, windowWidth:375, wordlist:[], searchword:'' }, onLoad: function () { const info = wx.getSystemInfoSync(); console.log('info',info); this.setData({ statusBarHeight:info.statusBarHeight }) }, onShow: function () { this.getData() }, onUnload: function () { }, onHide: function () { }, getData: function () { var that = this var url = 'v1/product/commend_words' var params = {} var success = function (res) { console.log('res',res.data.list); that.setData({ wordlist:res.data.list }) } _request.$get(url, params, success) }, setword:function(e){ var that = this; console.log('e',e); var word = e.currentTarget.dataset.word; that.setData({ searchword:word }) that.tosearch(); }, tosearch:function(){ console.log('tosearch') var word = this.data.searchword; if(word == ''){ word = this.data.wordlist[0]['title'] } wx.navigateTo({ url: '../projects/project-search/project-search?words=' + word }) }, bindword: function (e) { var word = e.detail.value; this.setData({ searchword: word }) }, })