邓洁:轮播图

This commit is contained in:
邓洁
2023-11-22 09:25:04 +08:00
parent fa8f90d1f9
commit fead9fb1d2
2 changed files with 42 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
<template>
<view class="root">
<InputAndSwiper @getQueryInfo="getInput"></InputAndSwiper>
<InputAndSwiper @getQueryInfo="getInput" :bannerURL="swiperList"></InputAndSwiper>
<view>
<view class="dropdown-bug">
@@ -32,6 +32,7 @@
pageSize: 3,
pageNum: 1,
searchInfoList: [],
swiperList: [],
customQuery: {},
searchListLength: '',
showNull: false,
@@ -62,17 +63,30 @@
this.pageNum = 1
}
},
created() {
this.getShopList()
this.getBanner()
},
methods: {
getInput(val){
console.log('搜索值',val);
if(this.pageNum!==1){
this.pageNum=1
getBanner() {
this.$api.getBanner().then(res => {
res.data.data.forEach(item => {
item.img = this.$api.imgUrl + item.img
})
this.swiperList = res.data.data
// .map(item => this.$api.imgUrl + item.img)
})
},
getInput(val) {
console.log('搜索值', val);
if (this.pageNum !== 1) {
this.pageNum = 1
}
const q = this.$u.queryParams({
type: 2,
pageSize: this.pageSize,
pageNum: this.pageNum,
kw:val
kw: val
})
this.$api.getShopList(q).then(res => {
this.searchListLength = res.data.data.length
@@ -118,10 +132,8 @@
})
return q
}
},
created() {
this.getShopList()
}
}
</script>

View File

@@ -1,6 +1,6 @@
<template>
<view class="root">
<InputAndSwiper @getQueryInfo="getInput"></InputAndSwiper>
<InputAndSwiper @getQueryInfo="getInput" :bannerURL="swiperList"> </InputAndSwiper>
<view>
<view class="dropdown-bug">
@@ -33,6 +33,7 @@
pageNum: 1,
shopInfoList: [],
customQuery: {},
swiperList: [],
shopListLength: '',
showNull: false,
refresh: false
@@ -57,22 +58,36 @@
if (!this.refresh && this.shopListLength !== 0) {
this.pageNum++
this.getShopList()
console.log("触底加载");
} else if (this.shopListLength == 0) {
this.pageNum = 1
}
},
created() {
this.getShopList()
this.getBanner()
},
methods: {
getInput(val){
console.log('搜索值',val);
if(this.pageNum!==1){
this.pageNum=1
getBanner() {
this.$api.getBanner().then(res => {
res.data.data.forEach(item => {
item.img = this.$api.imgUrl + item.img
})
this.swiperList = res.data.data
// .map(item => this.$api.imgUrl + item.img)
})
},
getInput(val) {
console.log('搜索值', val);
if (this.pageNum !== 1) {
this.pageNum = 1
}
const q = this.$u.queryParams({
type: 1,
pageSize: this.pageSize,
pageNum: this.pageNum,
kw:val
kw: val
})
this.$api.getShopList(q).then(res => {
this.shopListLength = res.data.data.length
@@ -117,9 +132,6 @@
})
return q
}
},
created() {
this.getShopList()
}
}
</script>