|
@@ -38,23 +38,34 @@
|
|
|
goodsType:[], // 商品分类
|
|
|
}
|
|
|
},
|
|
|
- onShow() {
|
|
|
- this.getbannerList()
|
|
|
- this.goodsList = []
|
|
|
- getGoodsClass({}).then(res => {
|
|
|
- console.log(res)
|
|
|
- if(res.status == 200){
|
|
|
- this.goodsType = res.data
|
|
|
- this.goodsType.map((item,index) => {
|
|
|
- this.getGoods(item,index)
|
|
|
- })
|
|
|
- }else{
|
|
|
- this.goodsList = []
|
|
|
- this.noDataText = '暂无商品'
|
|
|
- }
|
|
|
- })
|
|
|
+ onLoad() {
|
|
|
+ this.pageInit()
|
|
|
+ },
|
|
|
+ // 下拉刷新
|
|
|
+ onPullDownRefresh() {
|
|
|
+ console.log('refresh')
|
|
|
+ this.pageInit()
|
|
|
+ setTimeout(function () {
|
|
|
+ uni.stopPullDownRefresh()
|
|
|
+ }, 200)
|
|
|
},
|
|
|
methods: {
|
|
|
+ pageInit(){
|
|
|
+ this.getbannerList()
|
|
|
+ this.goodsList = []
|
|
|
+ getGoodsClass({}).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ if(res.status == 200){
|
|
|
+ this.goodsType = res.data
|
|
|
+ this.goodsType.map((item,index) => {
|
|
|
+ this.getGoods(item,index)
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.goodsList = []
|
|
|
+ this.noDataText = '暂无商品'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 点击banner
|
|
|
clickBanner(index){
|
|
|
let row = this.imageTopList[index]
|