<el-table-column label="查看職位" width="250"> <slot slot-scope="scope"> <el-link style="padding:0 5px" v-for="(v,index) in scope.row.job_ids" v-if='scope.row.job_ids !=""' type="primary" >職位{{index}}</el-link> </slot> </el-table-column> <el-table-column prop="route_path" label="查看門店" width="250"> <slot slot-scope="scope"> <el-link style="padding:0 5px" v-for="(v,index) in scope.row.job_ids" v-if='scope.row.job_ids !=""' type="primary" >職位{{index}}</el-link> </slot> </el-table-column>
主要是 運用 slot標簽 + 作用域插槽 slot-scope + v-for 將子組件的值渲染傳遞給父組件