vue scope的理解

xiaoxiao2021-03-01  20


<div class="div-tab"> <el-table :data="bankLists" > <el-table-column prop="index" label="index" type="index" :index="indexMethod"> </el-table-column> <el-table-column prop="id" label="编号"> </el-table-column> <el-table-column prop="interfaceNo" label="交易号"> </el-table-column> <el-table-column prop="remarks" label="备注"> </el-table-column> <el-table-column prop="writer" label="作者"> </el-table-column> <el-table-column prop="createDate" label="创建时间"> </el-table-column> <el-table-column prop="modifyDate" label="修改时间"> </el-table-column> <el-table-column prop="send" label="发送报文"> </el-table-column> <el-table-column prop="receive" label="接受报文"> </el-table-column> <el-table-column label="操作" width="100px"> <template slot-scope="scope"> <el-button size="small" type="primary" icon="el-icon-edit" @click="bank_mapping_edit(scope.row)"></el-button> <el-button size="small" type="danger" icon="el-icon-delete" @click="bank_mapping_del(scope.row)"></el-button> </template> </el-table-column> </el-table> </div>

参考这篇 scope

新版本的vue将scope变成slot-scope了


相当于el-table是一个插槽,它自带row index 各种属性,是父组件

scope=“scope”可以取得父组件的任何内容

先是在export default里给父组件传递data 然后scope可以拿到这个data为所欲为

转载请注明原文地址: https://www.6miu.com/read-4150147.html

最新回复(0)