简体   繁体   中英

Unhandled promise rejection InvalidCharacterError in IE11 with VEE Validate Vue.js and babel-polyfill

I have a problem in IE11 where i get a InvalidCharacterError when i validate a form with vee validate in vue.js. I think it could be a polyfill error but i'm not quite sure. I tried removing certain parts of my code to see if the problem is still there but i found nothing so far. I also tried labeling errors to see where the error is. I tried other solutions but nothing worked so far.

https://i.stack.imgur.com/PyYIn.png

Here is some code:

validateBeforeSubmit() {
    this.$validator.validateAll().then(result => {
        if (result) {
            //submit
        }
    })
}

the error only occurs when i press the submit button

edit:

this problem occured again recently. I already had babel-polyfill and i had imported it. I have other pages that use arrow functions and promises and those work fine in IE11.

Arrow functions is not supported by IE 11. You need to polyfill all the ES6+ syntax to make it compatible with IE 11. You could use babel to polyfill the code in your question:

(void 0).$validator.validateAll().then(function (result) {  
  if (result) {
      //submit
    }
});

You could also refer to the accepted answer in this thread about installing and importing babel-polyfill to make vue.js app compatible with IE 11.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM