前端开发-异常问题记录

Q1:Chrome 中文界面下默认会将小于 12px 的文本强制按照 12px 显示;

可通过加入 CSS 属性 -webkit-text-size-adjust: none; 解决

Q2:浏览器跨域问题(通过配置浏览器解决)

将chrome浏览器复制一个进行修改,修改完后,重新打开复制的浏览器

1、版本号49之前的跨域设置

      • 右键点击谷歌浏览器,选择属性
      • 在目标输入框尾部加上 --disable-web-security

2、版本号49之后的跨域设置

      • 在电脑上新建一个目录(任意位置) 例如 C:\dev
      • 右键点击谷歌浏览器,选择属性
      • 在目标输入框尾部加上 --disable-web-security --user-data-dir=C:\dev

Q3:echarts 图表,tooltip被容器遮挡,显示不全

confine:true // 限制tootip在容器内

tooltip: {
	trigger: 'axis',
  axisPointer: {
    type: 'shadow'
  },
  backgroundColor: '#fff',
  borderColor: 'none',
  extraCssText: 'box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);', // 附加阴影样式
  textStyle: {
    color: '#53565C'
  },
  confine: true     //限制tootip在容器内
},

Q4:Vue2动态路由导致第一次进入出现白屏问题

vue-router4版本第一次打开界面不匹配路由问题_router匹配不到路由_天外飞鲜橙子哥的博客-CSDN博客

1、删除通配符

{
  path: "*",
  redirect: "/",
}

2、在全局路由守卫添加拦截

next({ ...to, replace: true })
router.addRoute(autoRouter)

Q5:元素拖动,滚动条跟随改变

let scrollContainer = document.querySelector(".scrollContainer");
let dragContainer = document.querySelector(".dragContainer");
dragContainer.onmousedown = e => {
    //鼠标按下那一刻,滚动条的位置
    let mouseDownScrollPosition = {
        scrollLeft: scrollContainer.scrollLeft,
        scrollTop: scrollContainer.scrollTop
    };
    //鼠标按下的位置坐标
    let mouseDownPoint = {
        x: e.clientX,
        y: e.clientY
    };
    dragContainer.onmousemove = e => {
        //鼠标滑动的实时距离
        let dragMoveDiff = {
            x: mouseDownPoint.x - e.clientX,
            y: mouseDownPoint.y - e.clientY
        };
        scrollContainer.scrollLeft = mouseDownScrollPosition.scrollLeft + dragMoveDiff.x;
        scrollContainer.scrollTop = mouseDownScrollPosition.scrollTop + dragMoveDiff.y;
    };
    document.onmouseup = e => {
        dragContainer.onmousemove = null;
        document.onmouseup = null;
    };

};

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

兵腾傲宇

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值