在我的html中,我的标题中有这个
<!--[if lt IE 9]>
<script type="text/javascript" src="../shared/js/excanvas/r73/excanvas.js?v=${BUILD.TAG}"></script>
<![endif]-->
在我的 html 中,我的身体有这个
<!--[if lt IE 9]>
<body class="oldie">
<![endif]-->
<!--[if (gte IE 9)|!(IE)]>
<body>
<!--<![endif]-->
然后我像这样使用chart.js(使用jquery)
var isOldIE = $("body").hasClass("oldie");
var $canvas = this.$element.find("canvas");
var canvas = $canvas[0];
// kick old ie into creating fake canvas straight away
if(isOldIE) {
canvas = G_vmlCanvasManager.initElement(canvas);
}
var chartObj = new Chart(canvas.getContext("2d"));
// do your stuff eg
chartObj.Pie(CHARTJS_DATA, CHARTJS_CONFIG);