فهرست منبع

feat: 修复输入框问题

zhangyuhan 3 سال پیش
والد
کامیت
28ccf8076d
1فایلهای تغییر یافته به همراه13 افزوده شده و 6 حذف شده
  1. 13 6
      src/web/staticres/common-module/collection/js/money-mobile.js

+ 13 - 6
src/web/staticres/common-module/collection/js/money-mobile.js

@@ -171,15 +171,20 @@ var moneyComponent = {
   },
   mounted () {
     $('head').append(tempMoneyStyleComponent)
+    // 输入框问题处理
+    var fixedHeight = document.documentElement.clientHeight || 0
     var _this = this
     window.addEventListener('resize', function () {
-      if (document.activeElement.tagName == 'INPUT') {
-        if ($(document.activeElement).parents('.money-component-group').length) {
-          var isTall = $("#v-search-group .ent-search-pop").attr('data-height')
-          _this.changeViewForHeight(!isTall)
-        }
+      var tempH = document.documentElement.clientHeight || 0
+      if (tempH < fixedHeight) {
+        _this.changeViewForHeight(true)
+      } else {
+        _this.changeViewForHeight(false)
       }
     });
+    window.addEventListener('popstate',function () {
+      $(document.activeElement).trigger('blur')
+    })
   },
   computed: {
     getShowDiyInput () {
@@ -237,7 +242,9 @@ var moneyComponent = {
       var tempDom = $("#v-search-group .ent-search-pop")
       if (type) {
         var minHeightList = [document.documentElement.clientHeight || 0, document.body.clientHeight || 0, $(".app-layout-content-b").height() || 0].sort()
-        tempDom.attr('data-height', tempDom.height())
+        if (!tempDom.attr('data-height')) {
+          tempDom.attr('data-height', tempDom.height())
+        }
         tempDom.css({height: minHeightList[0] - 44})
       } else {
         tempDom.css({height: tempDom.attr('data-height')})