diff --git a/pages/index/search/search.js b/pages/index/search/search.js index 5f30368..f4d6ade 100644 --- a/pages/index/search/search.js +++ b/pages/index/search/search.js @@ -1,6 +1,6 @@ // pages/index/search/search.js import { - httpUtil,http, + httpUtil, http, location_city } from "../../../utils/util" Page({ @@ -11,16 +11,16 @@ Page({ data: {}, search_(keyword, city_id) { const search_his = wx.getStorageSync('search_his') || [] - if ((keyword && "undefined" !== keyword)||this.data.placeholder) { - if (!keyword ){ - keyword =this.data.placeholder + if ((keyword && "undefined" !== keyword) || this.data.placeholder) { + if (!keyword) { + keyword = this.data.placeholder } - for(var i=0; i { this.setData({ ip_info: res.ip_info, - cancel_noContWarn:true, + cancel_noContWarn: true, search_list: res.search_list, suggest_list: res.suggest_list }) @@ -101,10 +101,10 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - // 获取search关键词 - httpUtil("/api/v1/hot-search","get").then(res=>{ - this.setData({placeholder:res.keyword}) - }) + // 获取search关键词 + httpUtil("/api/v1/hot-search", "get").then(res => { + this.setData({ placeholder: res.keyword }) + }) let city_id if ('undefined' == options.city_id) { location_city().then(res => {