看到这段作用域插槽的用法不懂,想请教下,谢谢

查百度和官网好像都不是这种用法,看不懂,想请教一下大佬,谢谢
主要代码

<el-tabs v-model\="activeName" type\="border-card"\>  
  <el-table :data\="manyTableData" border stripe\>  
      <el-table-column type\="expand"\>  
        <template slot-scope\="scope"\>  
          <el-tag v-for\="(item, index) in scope.row.attr\_vals" :key\="index" closable\>{{item}}</el-tag\>  
          <el-input class\="input--newTag" v-if\="scope.row.inputVisible" v-model\="scope.row.inputValue" ref\="saveTagInput" size\="small" @keyup.enter.native\="handleInputConfirm(scope.row)"\></el-input\>  
          <el-button v-else size\="small" @click\="showInput(scope.row)"\>New Tag</el-button\>  
        </template\>  
      </el-table-column\>  
      <el-table-column label\="操作"\>  
        <template slot-scope\="scope"\>  
          <el-button type\="primary" size\="mini" icon\="el-icon-edit" @click\="showEditDialog(scope.row.attr\_id)"\>编辑</el-button\>  
          <el-button type\="primary" size\="mini" icon\="el-icon-delete" @click\="removeParams(scope.row.attr\_id)"\>删除</el-button\>  
        </template\>  
      </el-table-column\>  
    </el-table\>  
</el-tabs\>

manyTableData是这样的对象
image.png
image.png

阅读 2.4k
2 个回答

两个 template 作为 el-table-column 组件的默认slot ,并用到了 el-table-colum 的slot-scope, slot是el-table-column组件定义的,很合理啊

建议你查看文档能了解得更全面一些,
插槽语法
顺便slot-scope目前已被废弃,虽未被移除。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题