onresizeMixins.js 781 B

12345678910111213141516171819202122232425262728293031
  1. export const onresizeHandler = {
  2. data() {
  3. return {
  4. docmHeight: document.documentElement.clientHeight || document.body.clientHeight,
  5. showHeight: document.documentElement.clientHeight || document.body.clientHeight,
  6. isBtn: true //是否显示隐藏保存提交按钮(演练登记&教育培训)
  7. }
  8. },
  9. created() {},
  10. watch: {
  11. //监听显示高度
  12. showHeight: function () {
  13. if (this.docmHeight > this.showHeight) {
  14. //隐藏
  15. this.isBtn = false
  16. } else {
  17. //显示
  18. this.isBtn = true
  19. }
  20. }
  21. },
  22. mounted() {
  23. //监听事件
  24. window.onresize = () => {
  25. return (() => {
  26. this.showHeight = document.documentElement.clientHeight || document.body.clientHeight
  27. })()
  28. }
  29. }
  30. }