computed:{
...mapState({
cates:(state)=>state.DetailList.cates,
keyWords:(state)=>state.DetailList.keyWords,
itemList:(state)=>state.DetailList.promotedList,
slidingWords:(state)=>state.DetailList.slidingWords,
mainItem:(state)=>state.DetailList.mainItem,//这里获取数据
dImageList:(state)=>state.DetailList.dImageList
})
},
created(){
let self=this;
self.$nextTick(()=>{
let bannerBox = document.getElementById('slider-cont');//这里无法获取到ID
bannerBox.addEventListener("touchstart",(e)=>{
self.startX = e.touches[0].clientX;
self.startY = e.touches[0].clientY;
});
bannerBox.addEventListener("touchmove", self.touchPanMove);
bannerBox.addEventListener("touchend", self.touchPanEnd);
});
//绑定touch
},
因为在最外层有加
<div v-if="mainItem"></div>