computeOffset.js 367 B

12345678910111213141516171819
  1. // eslint-disable-next-line no-undef
  2. export default Behavior({
  3. behaviors: [],
  4. properties: {},
  5. data: {
  6. distance: 0
  7. },
  8. attached(){
  9. this.offsetMargin();
  10. },
  11. methods: {
  12. offsetMargin() {
  13. const { windowHeight, screenHeight } = wx.getSystemInfoSync();
  14. this.setData({
  15. distance: (screenHeight-windowHeight )
  16. });
  17. }
  18. }
  19. });