Vux: sticky组件没有预期的效果

Created on 11 Aug 2017  ·  3Comments  ·  Source: airyland/vux

<template>
  <div>
    <div>
      这是个header
    </div>
    <sticky>
      <div>This is a sticky</div>
    </sticky>
    <p v-for="n in N">段落{{n}}</p>
  </div>
`</template>`

<style>
</style>

<script>
  import {Sticky, Tab, TabItem} from 'vux'
  export default {
    data: function () {
      return {
        N: 100
      }
    },
    components: {
      Sticky,
      Tab,
      TabItem
    },
    methods: {}
  };
</script>

当stick包裹的组件上面仍然有内容时,sticky效果不起作用.
但是,当内容为"这是个header"的div容器不存在时,sticky包裹的内容可以保持一直在屏幕顶部的效果.
这是个.vue文件,在路由中匹配到该组件时,被渲染到App.vue中的<router-view>标签中, 是一个"新页面".
因此滚动容器应该是window, 然后我没有使用x-header组件.
请教一下问题出在哪里? 我在Android/ios真机上都看不到sticky的效果.

Most helpful comment

修改 vux/src/components/sticky/sticky.js 的41行,将
return document.documentElement.scrollTop
改为
return document.body.scrollTop + document.documentElement.scrollTop

All 3 comments

修改 vux/src/components/sticky/sticky.js 的41行,将
return document.documentElement.scrollTop
改为
return document.body.scrollTop + document.documentElement.scrollTop

@canval 现在正常了,是因为微信浏览器没清缓存的关系= =

@canval thx

Was this page helpful?
0 / 5 - 0 ratings

Related issues

skyshirt picture skyshirt  ·  4Comments

hjmmc picture hjmmc  ·  3Comments

RenShine picture RenShine  ·  4Comments

varHarrie picture varHarrie  ·  4Comments

GloriaCHL picture GloriaCHL  ·  4Comments