2

I would like to repeat adding table rows using a template tag with vue.js, but it doesn't work in IE11. Here is the code.

<table border="1">
  <tr>
    <td rowspan="2">ID</td>
    <td colspan="2">Name</td>
  </tr>
  <tr>
    <td>Height</td>
    <td>Weight</td>
  </tr>
<template v-repeat="items">
  <tr>
    <td rowspan="2">{{id}}</td>
    <td colspan="2">{{name}}</td>
  </tr>
  <tr>
    <td>{{height}}</td>
    <td>{{weight}}</td>
  </tr>
</template>
</table>

Any help?

3 Answers 3

2

See http://vuejs.org/guide/components.html#Using_Components and the warning at the end of that section:

The table element has restrictions on what elements can appear inside it, so custom elements will be hoisted out and not render properly. In those cases you can use the component directive syntax:

<tr v-component="my-component"></tr>.

Sign up to request clarification or add additional context in comments.

Comments

0

I found a solution that changed the <template> tag to a <tbody> tag. However there would be multiple <tbody> tags in a table, I hope this is the best solution in this case.

Comments

0

Make a long story short, This is HTML restrictions in IE, if you want compatibility, you will have to change your HTML structure.

I found an issue with similar question like yours here: https://github.com/vuejs/vue/issues/2404

Vue renders the template into real html before compiling it, so the same html restrictions apply for Vue templates, no matter how you define it.

IE does not support inside elements like , ..

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.