2016-04-23 137 views
0

我有一个模板,里面每个tr,我需要显示两个td s。这是通过这样的层次结构实现的:Vue.js <template>里面<tr>与IE 11

tbody 
    tr v-for 
    template v-for 
     td 
     td 

是的,循环内有一个循环。 Chrome对此没有任何问题,但IE拒绝显示它。我在这里有什么选择吗?

+0

模板不支持IE的所有HTTP ://caniuse.com/#feat=template。没有办法做到这一点,我知道,你将不得不手动拼出tds – Jeff

回答

0

杰夫已经在他的评论中解释了这个问题(IE不支持<template>)。

一个有点哈克的方式来解决这个问题是使用组件和is=""属性:

<tr v-for="thing in things"> 
    <td v-for="subThing in thing" is="hackyComponent" :item="subThing"> 

和hackyComponent:

<td>{{item.a}}</td> 
<td>{{item.b}}</td> 

export default { 
replace: true //replaces the original <td> with the template content 
       // Vue might complain about creating a "Fragment Instance" in development, but that's not a real problem. 

}