2016-04-23 134 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. 

}