VUE 插槽的使用

2023-01-11  本文已影响0人  一个健康马

插槽传参

模板组件

//name 插槽名称,:参数名=‘参数值’进行传参
 <slot name='footer' :$index='123' :row='3'>
 </slot>

接收参数

//v-slot:参数名=‘参数名’
 <template  v-slot:footer='scope'>
          <el-button size="mini" type="text"  @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
        </template> 

上一篇 下一篇

猜你喜欢

热点阅读