From 66499e14bdd54289bccdbd74c6e6283f797b8c7c Mon Sep 17 00:00:00 2001 From: fengchengzhi Date: Tue, 18 Sep 2018 03:35:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/view/home.vue | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/src/view/home.vue b/src/view/home.vue index 177950e..5ed69b6 100644 --- a/src/view/home.vue +++ b/src/view/home.vue @@ -109,9 +109,7 @@ }, computed: { -// swiper() { -// return this.$refs.mySwiper.swiper -// } + }, methods: { getName (){ @@ -124,6 +122,20 @@ localStorage.setItem('cityName',this.addressValue) }, + getCityName (){ + let name = localStorage.getItem("cityName")||'' + console.log(name) + if(!name){ + this.merchantNo = 2 + return + } + let arr = name.split(',') + this.addressValue = arr + let cityNameArr = arr[2].split('&') + let cityName = cityNameArr[1] + this.defaultCity = cityName + this.merchantNo = cityNameArr[2] + }, change (name) { this.addressValue = name }, @@ -185,7 +197,7 @@ //获取默认地址信息 getdefaultAddress (){ homeApi.getdefaultAddress().then(res => { - // console.log('默认地址信息',res) + console.log('默认地址信息',res) if ( res.code == 0 ){ if ( !res.data ){ this.show = true @@ -202,8 +214,8 @@ } else { this.$vux.toast.text(res.msg,"middle"); } - console.log(this.merchantNo) this.getGoodsList() + this.getCityName () }); } }, @@ -211,21 +223,6 @@ //异步加载 this.getdefaultAddress() this.getAddress() - -// window.onscroll = function() { -// -// var top = $(window).scrollTop() -// console.log(top); -// if(top > 20){ -// $('#top-nav').css({ -// 'position': 'fixed' -// }) -// }else { -// $('#top-nav').css({ -// 'position': 'relative' -// }) -// } -// }; }, destroyed () {