解决ie8前端兼容问题

21 篇文章 0 订阅
12 篇文章 0 订阅

indexof()用$.inArray("a", arr)代替

jq不能用prop获取元素属性,要用attr

layui上传组件upload before函数内不能用this.item获取当前元素,要用this.elem

Getmapping加上时间

ctx + '/' + url + "?time="+new Date().getTime()

<head></head>里面添加

    <meta http-equiv=Content-Type content="text/html;charset=utf-8">
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">

解决layui表格数据重载不刷新(过滤器配置禁用页面缓存)

import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @description:
 * @author: yang_kai
 * @date: 2020/9/24
 */
@Component
public class AddResponseHeaderFilter extends OncePerRequestFilter {
    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
        response.addHeader("Cache-Control", "no-cache");
        response.addHeader("Pragma", "no-cache");
        filterChain.doFilter(request, response);
    }
}

背景图片不能铺满全屏 :

img_bg {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: -1;
}
<img src="templetdata/static/images/banner.jpg" class="img_bg">

下拉框不显示(select标签里必须至少有一个option标签;innerText ):

                    <select name="secgId" id="secgId" required lay-verify="required">
                         <optgroup label="请选择">
                             <option value="">请选择</option>
                         </optgroup>
                    </select>
            $('#secgId').html('');
            var option1 = new Option('请选择', '', true);
            option1.innerText = '请选择';//必须
            $('#secgId').append(option1);
            for (var i = 0; i < data.length; i++) {
                var option2 = new Option(data[i].gradeName, data[i].secgId);
                option2.innerText = data[i].gradeName;
                $('#secgId').append(option2);
            }

ie8不支持Ajax跨域

删除crossDomain: true;

-----------------------------------------------------------------------------------

layui文件上传后台接口返回值类型用String和

return JSON.toJSONString(Map);

-----------------------------------------------------------------------------------

关于layui下拉框非空验证在ie8显示效果异常的修复

        return layui.each(d, function (l, r) {
            var o = t(this), c = o.attr("lay-verify").split("|"), u = o.attr("lay-verType"), d = o.val();
            /*修复*/
            if (o.is('select')) {
                if (o.val() == '') {
                    o.next().children().eq(0).children().eq(0).css('border-color','red');
                } else if (o.val() != '') {
                    o.next().children().eq(0).children().eq(0).css('border-color','');
                }else {

                }
            }
            /*修复*/
            if (o.removeClass(s), layui.each(c, function (t, l) {

ie8 new Date().getTime() 兼容问题

项目中使用 new Date().getTime()方法将 日期格式(年-月-日)转换为时间戳,但是IE无法转换基于'-'格式的日期字符串(默认是基于'/'格式的)。

var time = '2020-01-02 00:00:00'.replace(/-/g, '/');
var endTime = new Date(time).getTime();

监听input文本框的值

    $('#xxx').bind('input propertychange', function () {
        //获取input输入的值
        $('#x1').val($(this).val() * $('#x2').val());
    });

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值