page.json
{
"path": "",
"style": {
"navigationBarTitleText": "",
"navigationBarTextStyle": "black",
"navigationBarBackgroundColor": "#5a73ff",
"app-plus": {
"titleNView": {
"searchInput": {
"backgroundColor": "#ffffff",
"borderRadius": "10px",
"placeholder": "输入关键字",
"placeholderColor": "#6F7D9F"
}
}
}
}
},
搜索框内容发生改变事件
onNavigationBarSearchInputChanged(e) {
this.searchWords = e.text;
},
搜索框软键盘右下角搜索事件
onNavigationBarSearchInputConfirmed() {
uni.hideKeyboard();//隐藏软键盘
if (this.searchWords.trim().length == 0) {
//搜索框内容为空
return;
}
//搜索框内容不为空时操作
},
清除搜索框内容
// #ifdef APP-PLUS
// 获取当前页面的webview对象
var webView = this.$mp.page.$getAppWebview();
// 搜索框内容删除
webView.setTitleNViewSearchInputText('');
// #endif