2017-06-16 86 views
1

为什么不在Internet Explorer中工作?它在其他浏览器中完美工作。但这件微软事情让我发疯。vee-validator在Internet Explorer中不起作用

this.$validator.validateAll().then(() => { 
    var self = this; 
    var toSave = self.message; 
    $.ajax({ 
    type: "PUT", 
    url: messageUrl+'/'+self.message.id, 
    data: JSON.stringify(toSave), 
    contentType: "application/json; charset=utf-8", 
    dataType: "json", 
    success: function(data){ 
     router.push({name : 'message-list'}); 
    }, 
    error: function (errMsg) { 
     self.errorMessage = errMsg.status; 
    } 
    }); 
}).catch(() => { 
    self.errorMessage= 'Correct them errors!'; 
}); 

回答

2

没有版本的Internet Explorer支持arrow functions。我知道,它很糟糕。

不得不这样做老派。

var self = this; 
this.$validator.validateAll().then(function(){ 

    var toSave = self.message; 
    $.ajax({ 
     type: "PUT", 
     url: messageUrl+'/'+self.message.id, 
     data: JSON.stringify(toSave), 
     contentType: "application/json; charset=utf-8", 
     dataType: "json", 
     success: function(data){ 
      router.push({name : 'message-list'}); 
     }, 
     error: function (errMsg) { 
      self.errorMessage = errMsg.status; 
     } 
    }); 
}).catch(function(){ 
    self.errorMessage= 'Correct them errors!'; 
}); 
+0

谢谢。 @Bert Evans – radeveloper

相关问题