Browse Source

滚动

feature/feature-compatible
fengchengzhi 7 years ago
parent
commit
b64d8df3db
3 changed files with 39 additions and 14 deletions
  1. 7
      src/assets/styles/style.css
  2. 2
      src/components/nav-bottom.vue
  3. 44
      src/view/home.vue

7
src/assets/styles/style.css

@ -7,15 +7,16 @@ input:focus,button:focus,textarea:focus {
} }
html,body { html,body {
width: 100%; width: 100%;
height: 100%;
overflow-y: scroll;
height: auto;
/*overflow-y: scroll;*/
position: relative;
-webkit-overflow-scrolling : touch; -webkit-overflow-scrolling : touch;
background:rgba(243,243,243,1); background:rgba(243,243,243,1);
} }
#app { #app {
width: 100%; width: 100%;
height: 100%;
height: auto;
} }
.m-page { .m-page {

2
src/components/nav-bottom.vue

@ -54,7 +54,7 @@
font-weight:400; font-weight:400;
display: block; display: block;
} }
a.active {
.router-bottom a.active {
color: #29B079; color: #29B079;
} }
</style> </style>

44
src/view/home.vue

@ -1,7 +1,8 @@
<template> <template>
<div class="home">
<div ref="test" class="page-top">
<div class="home" style="height: auto;">
<div style="height: 0.9rem;"></div>
<div ref="header" class="page-top" id="top-nav" >
<i class="position" @click="show = true"><img src="../assets/images/icon/position.png"/>{{defaultCity}}</i> <i class="position" @click="show = true"><img src="../assets/images/icon/position.png"/>{{defaultCity}}</i>
<i class="logo"><img src="../assets/images/icon/logo.png" /></i> <i class="logo"><img src="../assets/images/icon/logo.png" /></i>
<i class="text"><a href="tel:400-6080100">联系客服</a></i> <i class="text"><a href="tel:400-6080100">联系客服</a></i>
@ -42,8 +43,8 @@
</li> </li>
</ul> </ul>
</div> </div>
<div style="height:1rem"></div>
</div> </div>
<div class="page-bottom"> <div class="page-bottom">
<routerFooter></routerFooter> <routerFooter></routerFooter>
</div> </div>
@ -92,6 +93,7 @@
} }
}, },
showLoading: true, showLoading: true,
searchBarFixed: false,
}; };
}, },
components: { components: {
@ -130,7 +132,6 @@
"merchantNo": this.merchantNo, "merchantNo": this.merchantNo,
"selectedDistrictId": this.districtId "selectedDistrictId": this.districtId
} }
// console.log(params)
homeApi.getGoods(params).then(res => { homeApi.getGoods(params).then(res => {
that.showLoading = false that.showLoading = false
if ( res.code == 0 ){ if ( res.code == 0 ){
@ -182,7 +183,7 @@
// //
getdefaultAddress (){ getdefaultAddress (){
homeApi.getdefaultAddress().then(res => { homeApi.getdefaultAddress().then(res => {
console.log('默认地址信息',res)
// console.log('',res)
if ( res.code == 0 ){ if ( res.code == 0 ){
if ( !res.data ){ if ( !res.data ){
this.show = true this.show = true
@ -202,17 +203,36 @@
console.log(this.merchantNo) console.log(this.merchantNo)
this.getGoodsList() this.getGoodsList()
}); });
},
}
}, },
mounted() { mounted() {
// //
this.getdefaultAddress() this.getdefaultAddress()
this.getAddress() 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 () {
} }
}; };
</script> </script>
<style> <style>
.home { .home {
width: 100%; width: 100%;
@ -225,11 +245,12 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-around; justify-content: space-around;
z-index: 1000;
position: absolute;
z-index: 100;
position: fixed;
top: 0; top: 0;
left: 0; left: 0;
} }
.home .page-top i { .home .page-top i {
font-style: normal; font-style: normal;
display: flex; display: flex;
@ -261,11 +282,11 @@
} }
.home .page-content { .home .page-content {
background:rgba(255,255,255,1); background:rgba(255,255,255,1);
padding-bottom: 1rem;
-webkit-overflow-scrolling : touch; -webkit-overflow-scrolling : touch;
overflow-y: scroll; overflow-y: scroll;
position: relative; position: relative;
top: 0; top: 0;
z-index: 10;
} }
.home .page-content .banner { .home .page-content .banner {
max-height: 3rem; max-height: 3rem;
@ -403,6 +424,7 @@
position: fixed; position: fixed;
bottom: 0; bottom: 0;
background:rgba(255,255,255,1); background:rgba(255,255,255,1);
z-index: 130;
} }
.picke-address .status-btn { .picke-address .status-btn {
display: flex; display: flex;
@ -443,4 +465,6 @@
.Loading-box .weui-icon_toast.weui-loading { .Loading-box .weui-icon_toast.weui-loading {
margin-top: 75%; margin-top: 75%;
} }
</style> </style>
Loading…
Cancel
Save