较少mixin在IE8上产生错误 [英] Less mixin generate error on IE8

查看:212
本文介绍了较少mixin在IE8上产生错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用此mixin时,我在IE8上收到此错误:

I receive this error on IE8 when I'm using this mixin:

SyntaxError: Object doesn't support property or method 'map'

>> less<<

    body{.gradient; 
}

>> mixin<<

.gradient(@color: #F5F5F5, @start: #EEE, @stop: #FFF) {
  background: @color;
  background: -webkit-gradient(linear,
                               left bottom,
                               left top,
                               color-stop(0, @start),
                               color-stop(1, @stop));
  background: -ms-linear-gradient(bottom,
                                  @start,
                                  @stop);
  background: -moz-linear-gradient(center bottom,
                                   @start 0%,
                                   @stop 100%);
  background: -o-linear-gradient(@stop,
                                 @start);
  filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@stop,@start));
}

有人可以解释一下为什么IE8会让我这个错误吗?
ty。

Can someone explain me why IE8 rise me this error ? ty.

推荐答案

看起来你正在使用less.js,这需要浏览器支持ES5。 ( map() 是在ES5中添加的 Array.prototype 的方法。

Looks like you are using less.js which requires the browser with ES5 support. (map() is a method of Array.prototype which was added in ES5).

IE8不支持ES5,但包括 es5-shim 之前,less.js应解决问题。

IE8 does not support ES5, but including es5-shim before less.js should fix the problem.

这篇关于较少mixin在IE8上产生错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆