首页 > 其他 > 详细

最近项目遇到问题总结

时间:2020-03-03 15:25:52      阅读:71      评论:0      收藏:0      [点我收藏+]

1、ios弹窗输入框,关闭后,页面顶上去不恢复的问题

解决方法:

function temporaryRepair() {
      const that = this;
      const windowFocusHeight = window.innerHeight;
      if (that.windowHeight === windowFocusHeight) {
        return;
      }
      let currentPosition;
      const speed = 1; // 页面滚动距离
      currentPosition = document.documentElement.scrollTop || document.body.scrollTop;
      currentPosition -= speed;
      window.scrollTo(0, currentPosition); // 页面向上滚动
      currentPosition += speed; // speed变量
      window.scrollTo(0, currentPosition); // 页面向下滚动
    }

2、输入框限制输入长度,输入emoj表情无法正确计数问题

解决办法:将emoj表情统一处理为一个长度

function  descInput() {
      // 让emoj表情的长度变成1 核心代码是下面2行,其他为业务代码
      const regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
      const len = this.info.reason.replace(regexAstralSymbols, ‘_‘).length;
      console.log(‘输入内容长度1‘, len);
      if (len === this.maxCount) {
        this.tipTxt = this.overLangTxt;
        this.isTipsShow = true;
      }
      this.info.reason = this.info.reason.slice(0, 200);
    },

 

最近项目遇到问题总结

原文:https://www.cnblogs.com/wuyuchao/p/12402222.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!