我目前正在嘗試格式化 vuetify 表中的一行(數組中的值應使用逗號和空格顯示.join())。為此,我使用動態#item。投幣口。只要我不使用join等,它就可以正常工作。這個有效:<template v-for="itm in filteredItem" v-slot:[`item.${itm}`]="{ item }" ><span :key="itm" class="red--text">{{ item[itm] }}</span></template >這是我想要工作的代碼(但不是):<template v-for="itm in filteredItem" v-slot:[`item.${itm}`]="{ item }" ><span :key="itm" class="red--text">{{ (item[itm]).join(', ') }}</span></template >頁面重新加載后,所有內容都已正確格式化。但是,一旦我在表中添加新項目或編輯現有項目,我就會收到錯誤(Error in render: "TypeError: Cannot read property 'join' of undefined")。我試圖在代碼沙盒上復制它。除了上面提到的錯誤之外,還會引發另一個錯誤(渲染中的錯誤:“TypeError:item[xtc] is undefined”)。除此之外,codeandbox 將 DataTable.vue 第 49 行中的反引號轉換為 unicode。為了讓它工作,必須改變它。
具有動態項目槽的 vuetify 數據表格式列
不負相思意
2022-06-09 09:56:55
