-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
106 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,28 @@ | ||
//index.js | ||
var WxSearch = require('../../wxSearchView/wxSearchView.js'); | ||
|
||
Page({ | ||
data: {}, | ||
|
||
// 搜索栏 | ||
onLoad: function () { | ||
var that = this; | ||
WxSearch.init( | ||
that, // 本页面一个引用 | ||
['杭州', '嘉兴', "海宁", "桐乡", '宁波', '金华'], // 热点搜索推荐,[]表示不使用 | ||
['湖北', '湖南', '北京',"南京"],// 搜索匹配,[]表示不使用 | ||
that.mySearchFunction // 提供一个搜索回调函数 | ||
); | ||
data: { | ||
searchValue:'' | ||
}, | ||
|
||
// 搜索页面跳回 | ||
onLoad: function (options) { | ||
if (options && options.searchValue){ | ||
this.setData({ | ||
searchValue: "搜索:"+options.searchValue | ||
}); | ||
} | ||
}, | ||
|
||
// 转发函数,固定部分 | ||
wxSearchInput: WxSearch.wxSearchInput, // 输入变化时的操作 | ||
wxSerchFocus: WxSearch.wxSearchFocus, // 输入框获得焦点 | ||
wxSearchKeyTap: WxSearch.wxSearchKeyTap, // 点击提示或者关键字、历史记录时的操作 | ||
wxSearchDeleteAll: WxSearch.wxSearchDeleteAll, // 删除所有的历史记录 | ||
wxSearchConfirm: WxSearch.wxSearchConfirm, // 搜索函数 | ||
wxSearchClear: WxSearch.wxSearchClear, // 清空函数 | ||
wxSearchBlur: WxSearch.wxSearchBlur, // 失去焦点函数 | ||
|
||
// 搜索回调函数 | ||
mySearchFunction: function (value) { | ||
// do your job here | ||
console.log("搜索值为:" + value) | ||
// 搜索入口 | ||
wxSearchTab: function () { | ||
wx.redirectTo({ | ||
url: '../search/search' | ||
}) | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"navigationBarTitleText":"wxSearchView搜索示例" | ||
"navigationBarTitleText": "首页" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
<include src="../../wxSearchView/wxSearchView.wxml" /> | ||
|
||
<view class="weui-search-bar"> | ||
<view class="weui-search-bar__form"> | ||
<view class="weui-search-bar__box"> | ||
<icon class="weui-icon-search_in-box" type="search" size="14"></icon> | ||
<input type="text" class="weui-search-bar__input" disabled='true' placeholder="搜索入口" bindtap="wxSearchTab"/> | ||
</view> | ||
</view> | ||
</view> | ||
|
||
<view>{{ searchValue}}</view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
//index.js | ||
var WxSearch = require('../../wxSearchView/wxSearchView.js'); | ||
|
||
Page({ | ||
data: {}, | ||
|
||
// 搜索栏 | ||
onLoad: function () { | ||
var that = this; | ||
WxSearch.init( | ||
that, // 本页面一个引用 | ||
['杭州', '嘉兴', "海宁", "桐乡", '宁波', '金华'], // 热点搜索推荐,[]表示不使用 | ||
['湖北', '湖南', '北京', "南京"],// 搜索匹配,[]表示不使用 | ||
that.mySearchFunction, // 提供一个搜索回调函数 | ||
that.myGobackFunction //提供一个返回回调函数 | ||
); | ||
}, | ||
|
||
// 转发函数,固定部分 | ||
wxSearchInput: WxSearch.wxSearchInput, // 输入变化时的操作 | ||
wxSearchKeyTap: WxSearch.wxSearchKeyTap, // 点击提示或者关键字、历史记录时的操作 | ||
wxSearchDeleteAll: WxSearch.wxSearchDeleteAll, // 删除所有的历史记录 | ||
wxSearchConfirm: WxSearch.wxSearchConfirm, // 搜索函数 | ||
wxSearchClear: WxSearch.wxSearchClear, // 清空函数 | ||
|
||
// 搜索回调函数 | ||
mySearchFunction: function (value) { | ||
// do your job here | ||
// 跳转 | ||
wx.redirectTo({ | ||
url: '../index/index?searchValue='+value | ||
}) | ||
}, | ||
|
||
// 返回回调函数 | ||
myGobackFunction: function (value) { | ||
// do your job here | ||
// 跳转 | ||
wx.redirectTo({ | ||
url: '../index/index?searchValue=返回' | ||
}) | ||
} | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"navigationBarTitleText": "wxSearchView搜索示例" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<include src="../../wxSearchView/wxSearchView.wxml" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@import "../../wxSearchView/wxSearchView.wxss"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters