tested it with chrome, firefox, opera and internet explorer and the error only occurs in firefox.
I have two computed properties in vue js and they change pretty much at the same time.
when i change my select box both get triggered because this.gekozenWinding
get changed when i select a different option inside the select box.
Here is my code for both properties:
kant() {
if (this.gekozenWinding != null) {
var id = this.haalID(this.windings, this.gekozenWinding);
parseInt(id);
if (id < 5 && id > 0) return true;
else {
return false;
}
}
},
graden() {
if (this.gekozenWinding != null) {
var id = this.haalID(this.windings, this.gekozenWinding);
switch (id) {
case "1":
return "180"; break;
case "2":
return "0"; break;
case "3":
return "270"; break;
case "4":
return "90"; break;
case "5":
return "180"; break;
case "6":
return "0"; break;
case "7":
return "270"; break;
case "8":
return "90"; break;
}
} else {
return "0";
}
}
My method haalID()
haalID(lijst, item) {
/*
1.Filters out given item(string) from a lijst(array).
2.Gets the ID from the filtered object.
3. returns the ID
*/
var id = lijst.filter(i => i.Descriptions[0].Description == item);
id = id[0].Id;
return id;
}
And this is inside my template
<div class="row">
<div class="form-group col-9">
<label>Winding</label>
<select
class="form-control"
v-model="gekozenWinding"
>
<option
v-for="winding in windings"
v-bind:key="winding.Id"
>{{winding.Descriptions[0].Description}}</option>
</select>
</div>
</div>
<div v-if="gekozenWinding != null && gekozenWinding != 'To determine'">
<div class="parent1" v-if="kant ">
<img id="fto1" src="../assets/buitenkant.png" alt>
<img
id="fto2"
v-bind:style="{'transform': `rotate(${graden}deg)`}"
src="../assets/A.png"
alt
>
</div>
<div class="parent2" v-else>
<img id="fto3" src="../assets/Binnenkant.png" alt>
<img
id="fto4"
v-bind:style="{'transform': `rotate(${graden}deg)`}"
src="../assets/A.png"
alt
>
</div>
</div>
Again this only occurs in internet explorer(using the 11) other browsers works perfectly.
I even tried to change my code mutliple times can't get it to work in IE
Arrow functions are not supported in IE11 (or any IE for that matter).
caniuse.com/#search=arrow%20functions -
You'll need to use a compiler like Babel, or avoid arrow functions.
var id = lijst.filter(function (i) {
return i.Descriptions[0].Description == item;
});