serach input 8.9 #141
@ -77,17 +77,37 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
this.value = option.value
|
this.value = option.value;
|
||||||
this.setViewHeight();
|
this.setViewHeight();
|
||||||
this.ShopSearch()
|
this.ShopSearch()
|
||||||
|
this.setNavSearchInput();
|
||||||
},
|
},
|
||||||
onNavigationBarSearchInputConfirmed(value) {
|
onNavigationBarSearchInputConfirmed(value) {
|
||||||
this.value = value.text
|
this.value = value.text
|
||||||
console.log(this.value)
|
console.log(this.value)
|
||||||
this.ShopSearch()
|
this.ShopSearch()
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
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){
|
changeType(member_id){
|
||||||
console.log(member_id);
|
console.log(member_id);
|
||||||
this.$emit("pChangeType")
|
this.$emit("pChangeType")
|
||||||
|
@ -58,9 +58,28 @@ export default {
|
|||||||
onNavigationBarSearchInputConfirmed(value) {
|
onNavigationBarSearchInputConfirmed(value) {
|
||||||
this.value = value.text
|
this.value = value.text
|
||||||
this.ShopSearch()
|
this.ShopSearch()
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
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() {
|
setOrderSort() {
|
||||||
let sort = '';
|
let sort = '';
|
||||||
if(this.current == 0) {
|
if(this.current == 0) {
|
||||||
@ -75,6 +94,8 @@ export default {
|
|||||||
},
|
},
|
||||||
// 排序方式 goods_salenum:销量 evaluation_count:评价 goods_price_asc:价格从低到高 goods_price_desc:价格从高到低
|
// 排序方式 goods_salenum:销量 evaluation_count:评价 goods_price_asc:价格从低到高 goods_price_desc:价格从高到低
|
||||||
async ShopSearch({ load = 'reload' } = {}) {
|
async ShopSearch({ load = 'reload' } = {}) {
|
||||||
|
console.log(this.value);
|
||||||
|
this.setNavSearchInput(this.value);
|
||||||
const sort = this.setOrderSort();
|
const sort = this.setOrderSort();
|
||||||
const res = await this.$u.api.ShopSearch({
|
const res = await this.$u.api.ShopSearch({
|
||||||
keyword: this.value,
|
keyword: this.value,
|
||||||
|
Loading…
Reference in New Issue
Block a user