[英]Javascript function undefined in IE
這適用於Chrome和FF,但不適用於IE:我在主體中間調用JS:
<li><a href="#" onclick="destroy(80)" >Delete</a></li>
我這樣加載我的JS文件( 就在關閉body標簽之前 ):
<script src="https://thing.test/js/things-common.js"></script>
它具有如下功能:
function destroy(id)
swal({
text: "Do you really want to delete this thing?",
icon: "warning",
buttons: true,
dangerMode: true,
})
.then((willDelete) => {
if (willDelete) {
//AJAX the delete
AxiosDestroyThing(id);
}
});
}
IE(11)給出: 'destroy' is undefined
我一直在使用Chrome進行開發,這是我第一次必須支持IE。
我在做傻事嗎?
更新資料
我已經添加了該功能的完整代碼。 這是因為甜蜜警報(swal)正在使用ES6嗎?
添加評論后添加了更多詳細信息。
這是因為我使用的是ES6的箭頭功能。
我將功能更改為:
function destroy(id) {
swal({
text: "Do you really want to delete this thing?",
icon: "warning",
buttons: true,
dangerMode: true
}).then(function (willDelete) {
if (willDelete) {
//AJAX the delete
AxiosDestroyThing(id);
}
});
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.