Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {Search} from "vant";
export default {
name:"page",
components:{
whitespace,
pageLine,
pageText,
notice,
// search,
pageTitle,
cube,
[imageAd.name]:imageAd,
imageText,
product,
[Search.name]: Search
},
data:function(){
return{
topheight:0,
page:{},
keyword: '', // 搜索关键词
banners: [], // Banner 列表
productRecommends: [], // 推荐商品列表
}
},
created:function(){
// GetPage().then(response=>{
// this.page=response;
// });
},
initViews() {
getHome().then(res => {
this.shopInfos = res.data.data;
});
}
},
components: {
[Row.name]: Row,
[Col.name]: Col,
[Card.name]: Card,
[Toast.name]: Toast,
[CouponCell.name]: CouponCell,
[CouponList.name]: CouponList,
[Search.name]: Search,
[Panel.name]: Panel,
[List.name]: List,
[Swipe.name]: Swipe,
[SwipeItem.name]: SwipeItem,
[Tabbar.name]: Tabbar,
[TabbarItem.name]: TabbarItem,
[Tag.name]: Tag,
[Grid.name]: Grid,
[GridItem.name]: GridItem
}
};
});
},
cancelCollect(event, i, item) {
this.$dialog.confirm({ message: '是否取消收藏该商品' }).then(() => {
collectAddOrDelete({ valueId: item.valueId, type: 0 }).then(res => {
this.list.splice(i, 1);
});
});
},
itemClick(id) {
this.$router.push(`/items/detail/${id}`);
}
},
components: {
[Search.name]: Search,
[IsEmpty.name]: IsEmpty,
[List.name]: List,
[Card.name]: Card
}
};
},
scrollShowArrow() {
this.showArrow = document.getElementById('app').scrollTop > 120;
},
backTop() {
document.getElementById('app').scrollTop = 0;
},
itemClick(i) {
this.$router.push({ name: 'detail', params: { itemId: i } });
}
},
components: {
[ItemGroup.name]: ItemGroup,
[ItemCardHori.name]: ItemCardHori,
[Search.name]: Search,
[List.name]: List,
[IsEmpty.name]: IsEmpty
}
};
this.page += 1;
await this.searchGoods();
this.loading = false;
if (this.pages <= this.page) {
this.finished = true;
}
},
itemClick(id) {
this.$router.push(`/items/detail/${id}`);
}
},
activated() {
this.wordHistory = this.getKeyWordHistory();
},
components: {
[Search.name]: Search,
[Card.name]: Card,
[Tag.name]: Tag,
[List.name]: List,
[IsEmpty.name]: IsEmpty
}
};
catalogList({ id: id}).then(res => {
let index = getIndex(this.list, res.data.data.currentCategory.id);
this.$refs.classTree.changeList(res.data.data);
this.subCategory = res.data.data.currentSubCategory;
if (this.subCategory.length === 0) this.isEmpty = true;
});
},
toItemList(id) {
this.$router.push({
name: 'list',
query: { keyword: '', itemClass: id }
});
}
},
components: {
[Search.name]: Search,
[classTree.name]: classTree,
[IsEmpty.name]: IsEmpty
}
};
changeCatalog(id) {
catalogCurrent({ id: id}).then(res => {
let data = res.data.data;
this.currentCategory = data.currentCategory;
this.currentSubCategoryList = data.currentSubCategory;
});
},
toItemList(id) {
this.$router.push({
name: 'category',
query: { keyword: '', itemClass: id }
});
}
},
components: {
[Search.name]: Search
}
};