后臺返回的數據
顯示效果:
html:
<el-table-columnalign="center"label="使用過的小程序"width="124"v-if="activeTab == 0"><template #default="scope"><divv-for="(item, index) in scope.row.used_applet.split(',')":key="index">{{ appletVal[item] }}// 判斷最后一個元素不顯示、<span v-if="index !== scope.row.used_applet.split(',').length - 1">、</span></div></template></el-table-column><el-table-columnalign="center"label="注冊來源"width="124"v-if="activeTab == 0"><template #default="scope">{{ scope.row.source ? appletVal[scope.row.source] : "-" }}</template></el-table-column>
?js:
const appletVal = {0: "-",1: "跳樂樂小程序",2: "競賽車小程序",3: "室外小程序"
};//如果返回的值是按1,2,3三這種下標順序返回的可以直接簡寫成下面的形式,沒有為0的返回值,所以第一位空出來
//const appletVal = ["", "跳樂樂小程序", "競賽車小程序", "室外小程序"];