参考文章:https://www.freesion.com/article/9064996860/
const page = document.querySelectorAll(".uni-input-input[type=search]")[0];
this.changeInput(page,this.keyword)
},
components:{
shopList
},
methods: {
changeInput(dom, st) {
var evt = new InputEvent('input', {
inputType: 'insertText',
data: st,
dataTransfer: null,
isComposing: false
});
dom.value = st;
dom.dispatchEvent(evt);
}
}
// 动态设置导航栏搜索框内容
const setNavSearchInput=(keyword)=>{
// #ifdef APP-PLUS
let webView = this.
m
p
.
p
a
g
e
.
mp.page.
mp.page.getAppWebview();
webView.setTitleNViewSearchInputText(keyword);
// #endif
// #ifdef H5
let inputSearch=document.querySelector(‘.uni-input-input[type=search]’);
var evt = new InputEvent(‘input’, {
inputType: ‘insertText’,
data: keyword,
dataTransfer: null,
isComposing: false
});
if(inputSearch){
inputSearch.value = keyword;
inputSearch.dispatchEvent(evt);
}
// #endif
}
"h5": {
"titleNView": {
// "titleText": "搜索结果",
"searchInput": {
"placeholder": "nike",
"disabled": true,
"align": "left",
"borderRadius": "15px",
"backgroundColor": "#F7F7F7",
"placeholderColor": "#B3B3B3"
}
// "buttons": [{
// "float": "right",
// "color": "#636263",
// "text": "筛选",
// "fontSize": "14px",
// "width":"60px"
// }
// ]
}
}
// "app-plus": {
// "scrollIndicator": "none",
// "titleNView": {
// "searchInput": {
// "placeholder": "nike",
// "disabled": true,
// "align": "left",
// "borderRadius": "15px",
// "backgroundColor": "#F7F7F7",
// "placeholderColor": "#B3B3B3"
// },
// "buttons": [{
// "float": "right",
// "color": "#636263",
// "text": "筛选",
// "fontSize": "14px",
// "width":"60px"
// }
// ]
// }
// }