fixing bug 8.11

This commit is contained in:
2020-08-11 15:38:43 +08:00
parent c01470b52d
commit 37d8ab7a2b
10 changed files with 170 additions and 98 deletions

View File

@@ -18,10 +18,12 @@ export default {
searchwordlist: [],
}
},
// type: 2 商品 1: 其他
// type: 1 商品 2: 其他
onLoad(option) {
this.type = option.type;
this.getWordList();
if(option.type == 1) this.setNavSearchInput('搜索您需要的商品');
else if(option.type == 2) this.setNavSearchInput('请输入搜索内容');
},
// 点击搜索按钮
onNavigationBarButtonTap(e) {
@@ -36,6 +38,31 @@ export default {
this.search(this.keyword);
},
methods:{
setNavSearchInput(placeholder) {
// #ifdef APP-PLUS
// 修改 placeholder
webview.setStyle({
'titleNView': {
"searchInput": { //修改当前窗口search样式
"placeholder": placeholder,
}
}
})
// #endif
// #ifdef H5
let inputSearch=document.querySelector('.uni-input-input[type=search]');
const evt = new InputEvent('input', {
inputType: 'insertText',
data: keyword,
dataTransfer: null,
isComposing: false
});
if(inputSearch){
inputSearch.value = keyword;
inputSearch.dispatchEvent(evt);
}
// #endif
},
getWordList() {
this.$u.api.searchwordlist({type:this.type}).then(res => {
console.log(res)