欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue for循環(huán)出來(lái)的數(shù)據(jù)實(shí)現(xiàn)用逗號(hào)隔開(kāi)

 更新時(shí)間:2024年10月16日 09:08:45   作者:性野喜悲  
HTML(HyperText Markup Language)是用于創(chuàng)建網(wǎng)頁(yè)的標(biāo)準(zhǔn)標(biāo)記語(yǔ)言,正確的HTML編碼和結(jié)構(gòu)對(duì)于網(wǎng)頁(yè)的正確顯示至關(guān)重要,當(dāng)HTML代碼正確無(wú)誤時(shí),網(wǎng)頁(yè)的效果圖將與設(shè)計(jì)師的預(yù)期相符,反之則可能出現(xiàn)布局錯(cuò)亂、樣式失效等問(wèn)題

vue for循環(huán)出來(lái)的數(shù)據(jù)用逗號(hào)隔開(kāi)

  • HTML:
//tableData為后臺(tái)返回的數(shù)據(jù),roleList為表格對(duì)象中的子數(shù)組 
<el-table :data="tableData" style="width: 100%">
      <el-table-column
                  label="所屬角色"
                  min-width="160"
                  show-overflow-tooltip
                >
                  <template slot-scope="scope">
                    <span
                      v-for="(item, index) in scope.row.roleList"
                      :key="index"
                      >{{item.roleName}}</span
                    >
                  </template>
                </el-table-column>
</el-table>

效果圖(實(shí)際是兩個(gè)角色)

  • 正確的HTML:
//tableData為后臺(tái)返回的數(shù)據(jù),roleList為表格對(duì)象中的子數(shù)組 
<el-table :data="tableData" style="width: 100%">
      <el-table-column
                  label="所屬角色"
                  min-width="160"
                  show-overflow-tooltip
                >
                  <template slot-scope="scope">
                    <span
                      v-for="(item, index) in scope.row.roleList"
                      :key="index"
                      >{{scope.row.roleList.length-1!==index?item.roleName+',':item.roleName}}</span
                    >
                  </template>
                </el-table-column>
</el-table>

正確的效果圖(使用逗號(hào)隔開(kāi)了的效果)

總結(jié)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論