我如何在ie11中单独使用babel
how can I use babel stand alone in ie11
我正在尝试单独使用 babel。
一切正常,直到 ie11。在 ie11 中我得到一个空白页面并且找不到任何错误。
运行 下面的代码片段。
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.7.7/handlebars.min.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<div id="templateContainer"></div>
<script id="template" type="text/x-handlbars-template">
<div class="container">
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
{{#each panels}}
<!-- Academic Group -->
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="{{id}}">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse{{@index}}"><span class="glyphicon glyphicon-plus"></span>{{title}}</a>
</h4>
</div>
<div id="collapse{{@index}}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="{{id}}">
<ul class="list-group">
{{#each this.children}}
<li class="list-group-item">
<span class="glyphicon glyphicon-minus text-primary"></span>
<a href="/sites/csl/SitePages/StaffHelpPages/{{this.aspx}}.aspx" title="{{title}}">{{title}}</a>
</li>
{{/each}}
</ul>
</div>
</div>
{{/each}}
</div>
</div>
</script>
<script type="text/babel" data-presets="es2015, es2016, es2017, stage-3">
const data = {
panels: [
{
title: 'Academic', id: 'headingOne',
children: [
{ title: 'AY20 Academic Calendar', aspx: 'AY_Calendar' },
{ title: 'Compass', aspx: 'Compass' },
{ title: 'Gift Funds', aspx: 'Gift_Funds' },
{ title: 'Manuscript Clearance for Public Release', aspx: 'Manuscript_Clearance_for_Public_Release' },
{ title: 'Mementos', aspx: 'Mementos' },
]
},
{
title: 'Admin', id: 'headingTwo',
children: [
{ title: 'Alternate_Work_Schedule', aspx: 'Alternate Work Schedule' },
{ title: 'Civilian Personnel System Access Requests', aspx: 'Civilian_Personnel_System_Access_Requests' },
{ title: 'Comp Time / Overtime Form', aspx: 'Comp_Time_Form' },
{ title: 'CSL Leadership Contact Numbers', aspx: 'CSL_Leadership_Contact_Numbers' },
{ title: 'Federal and Training Holidays', aspx: 'Federal_and_Training_Holidays' },
{ title: 'Gears', aspx: 'Gears' },
{ title: 'HHD Leave and Passes', aspx: 'HHD_Leave_and_Passes' },
{ title: 'Military Leave Requests', aspx: 'Military Leave Requests' },
{ title: 'NCOER', aspx: 'NCOER' },
{ title: 'Pentagon', aspx: 'Pentagon' },
]
},
]
}
const source = $("#template").html();
const template = Handlebars.compile(source);
const output = template(data);
$("#templateContainer").append(output);
</script>
以防其他人遇到这个问题,在 babel stand alone 在 ie11 中修复它之前添加 core-js。
<script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/3.16.0/minified.js" type="text/javascript"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
我正在尝试单独使用 babel。 一切正常,直到 ie11。在 ie11 中我得到一个空白页面并且找不到任何错误。
运行 下面的代码片段。
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.7.7/handlebars.min.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<div id="templateContainer"></div>
<script id="template" type="text/x-handlbars-template">
<div class="container">
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
{{#each panels}}
<!-- Academic Group -->
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="{{id}}">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse{{@index}}"><span class="glyphicon glyphicon-plus"></span>{{title}}</a>
</h4>
</div>
<div id="collapse{{@index}}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="{{id}}">
<ul class="list-group">
{{#each this.children}}
<li class="list-group-item">
<span class="glyphicon glyphicon-minus text-primary"></span>
<a href="/sites/csl/SitePages/StaffHelpPages/{{this.aspx}}.aspx" title="{{title}}">{{title}}</a>
</li>
{{/each}}
</ul>
</div>
</div>
{{/each}}
</div>
</div>
</script>
<script type="text/babel" data-presets="es2015, es2016, es2017, stage-3">
const data = {
panels: [
{
title: 'Academic', id: 'headingOne',
children: [
{ title: 'AY20 Academic Calendar', aspx: 'AY_Calendar' },
{ title: 'Compass', aspx: 'Compass' },
{ title: 'Gift Funds', aspx: 'Gift_Funds' },
{ title: 'Manuscript Clearance for Public Release', aspx: 'Manuscript_Clearance_for_Public_Release' },
{ title: 'Mementos', aspx: 'Mementos' },
]
},
{
title: 'Admin', id: 'headingTwo',
children: [
{ title: 'Alternate_Work_Schedule', aspx: 'Alternate Work Schedule' },
{ title: 'Civilian Personnel System Access Requests', aspx: 'Civilian_Personnel_System_Access_Requests' },
{ title: 'Comp Time / Overtime Form', aspx: 'Comp_Time_Form' },
{ title: 'CSL Leadership Contact Numbers', aspx: 'CSL_Leadership_Contact_Numbers' },
{ title: 'Federal and Training Holidays', aspx: 'Federal_and_Training_Holidays' },
{ title: 'Gears', aspx: 'Gears' },
{ title: 'HHD Leave and Passes', aspx: 'HHD_Leave_and_Passes' },
{ title: 'Military Leave Requests', aspx: 'Military Leave Requests' },
{ title: 'NCOER', aspx: 'NCOER' },
{ title: 'Pentagon', aspx: 'Pentagon' },
]
},
]
}
const source = $("#template").html();
const template = Handlebars.compile(source);
const output = template(data);
$("#templateContainer").append(output);
</script>
以防其他人遇到这个问题,在 babel stand alone 在 ie11 中修复它之前添加 core-js。
<script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/3.16.0/minified.js" type="text/javascript"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>