x
>
x
>
var app = new Vue({
data: {
selectVal:'',//下拉选择的值
isRenderSel:false//是否渲染好了下拉框值
},
created: function() {
this.storeJson = [
"深圳1店",
"深圳2店",
"深圳3店",
"深圳4店",
"深圳5店",
"深圳6店",
"深圳7店",
"深圳8店",
"深圳9店",
"深圳10店",
"深圳11店",
"深圳12店",
"深圳13店",
"深圳14店",
"深圳15店",
"深圳16店",
"深圳17店",
"深圳18店",
"深圳19店",
"深圳20店",
"深圳21店",
"深圳22店",
"深圳23店",
"深圳24店",
"深圳25店"
]
},
mounted: function() {
console.log(this.storeJson.length);
},
methods: {
selectDept: function () {
var self = this;
self.showFooterTab(self.storeJson);
},
clearDepartment: function () {
var self = this;
self.selectVal = '';
},
showFooterTab: function(arr){
var me = this;
if(this.isRenderSel){
this.footerSwiper.slideTo(0);
this.footerTabEl.show();
}else{
var el = this.footerTabEl= $('#footer-select');
this.wrapperEl = $('#footer-tab-wapper');
if(arr && arr.length > 0){
this.wrapperEl.html("");
for(var i=0,j=arr.length; i'+arr[i]+'');
}
el.show();
}
this.footerSwiper = new Swiper('.swiper-container', {
direction: 'vertical',
slidesPerView: 3,//底部参数用3,
spaceBetween: 0,
centeredSlides: true,
slideActiveClass : 'swiper-slide-active',
});
el.find('.close-btn').click(function(){
el.hide();
});
$('.payment').click(function(){
el.hide();//单击选择框其它部分也关闭
});
this.isRenderSel = true;
}
this.footerTabEl.find('.confirm-btn').off('click').click(function(){
var txt = me.wrapperEl.find('.swiper-slide-active').text();
me.selectVal = txt;
me.footerTabEl.hide();
})
}
},
watch: {}
}).$mount("#app")