Merge pull request 'serach input 8.9' (#141) from zhy into master

Reviewed-on: http://git.luyuan.tk/luyuan/deming/pulls/141
This commit is contained in:
hansu 2020-08-09 19:07:20 +08:00
commit 8b6bf2da03
2 changed files with 44 additions and 3 deletions

View File

@ -77,17 +77,37 @@ export default {
}
},
onLoad(option) {
this.value = option.value
this.value = option.value;
this.setViewHeight();
this.ShopSearch()
this.setNavSearchInput();
},
onNavigationBarSearchInputConfirmed(value) {
this.value = value.text
console.log(this.value)
this.ShopSearch()
},
methods: {
//
setNavSearchInput(keyword) {
// #ifdef APP-PLUS
let webView = this.$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
},
changeType(member_id){
console.log(member_id);
this.$emit("pChangeType")

View File

@ -58,9 +58,28 @@ export default {
onNavigationBarSearchInputConfirmed(value) {
this.value = value.text
this.ShopSearch()
},
methods: {
setNavSearchInput(keyword) {
console.log(keyword);
// #ifdef APP-PLUS
let webView = this.$mp.page.$getAppWebview();
webView.setTitleNViewSearchInputText(keyword);
// #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
},
setOrderSort() {
let sort = '';
if(this.current == 0) {
@ -75,6 +94,8 @@ export default {
},
// goods_salenum evaluation_count goods_price_asc goods_price_desc
async ShopSearch({ load = 'reload' } = {}) {
console.log(this.value);
this.setNavSearchInput(this.value);
const sort = this.setOrderSort();
const res = await this.$u.api.ShopSearch({
keyword: this.value,