K
K
kot25662019-02-13 20:51:00
JavaScript
kot2566, 2019-02-13 20:51:00

IE 11 - why is there an error in the method declaration?

In IE 11, this error appears:
5c645734225f2700433442.png
Swears at the line with the handler function inside the watch function , which is inside the Vue application:

// v.1
  watch: {
    numbers:  {
     handler(val, oldVal)  {
        // some code
      },
       deep: true
    }
 }

If you change the code to the following, then there is no error, but then tracking numbers does not work.
// v.2
  watch:  {
   numbers: function (val):  {                    
      // some code
   }                  
}

How to make the first option work in IE?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Proskurin, 2019-02-13
@kot2566

IE doesn't understand methods , write as a property with a function.

watch: {
    numbers:  {
     handler: function(val, oldVal)  {
        // some code
      },
       deep: true
    }
 }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question