[Vuejs]-Alternative syntax for Vue on IE11

1👍

Typically I would recommend doing string concatenations and manipulations in the JS logic itself instead of within the template, so that it is easier to reason about. Your problem can be solved if you bind a method to the id attribute:

<div class="inputWrap" v-for="(thing,index) in things">
  <input type="checkbox" v-model="another_thing" :id="getCheckboxId(index)">
</div>

You can then create a new method in your VueJS component that returns the appropriate ID:

methods: {
  getCheckboxId: function(index) {
    return 'another_thing_' + index;
  }
}
👤Terry

0👍

Template Literals are not supported in IE 11. You can just concatenate the string using + or you can try using the concat() method instead to append the index number of your loop to your id like this:

<input type="checkbox" v-model="another_thing" :id="another_thing_" + index)> // using +
<input type="checkbox" v-model="another_thing" :id="another_thing_".concat(index)> // using concat()

Leave a comment