[Vuejs]-Reactivity issue in IE browser

0👍

the problem is here

getTrackerIntervalData () {

        setInterval(()=>myTimer(this), 5000);

        function myTimer(th) {
             return axios.get("https://seo-gmbh.eu/couriertracker/json/couriertracker_api.php?action=get_tracking_data&key_id=" + th.$route.params.tracking.toLowerCase() , {
             })
            .then(response => {
              th.$store.commit('tracking/setTrackingServerData', response.data.data.tracking_data);
            })
            .catch(function (error) {
              console.log(error);
            });
        }
    }

IE dosent support arrow function.
you should do it like so

getTrackerIntervalData () {
let vm=this;
        setInterval(function(){myTimer(vm)}, 5000);

        function myTimer(th) {
             return axios.get("https://seo-gmbh.eu/couriertracker/json/couriertracker_api.php?action=get_tracking_data&key_id=" + th.$route.params.tracking.toLowerCase() , {
             })
            .then(response => {
              th.$store.commit('tracking/setTrackingServerData', response.data.data.tracking_data);
            })
            .catch(function (error) {
              console.log(error);
            });
        }
    }

because vue use webpack. normally arrow function will be transform to normal function to support all browsers but maybe for some reason the setInterval with arrow function not transform. try it maybe that the problem

Leave a comment