是什么:作用域插槽
做什么:解決父組件模板的所有東西都會在父級作用域內編譯;子組件模板的所有東西都會在子級作用域內編譯------父組件的模板是無法使用到子組件模板中的數據
slot-scope的出現卻實現了父組件調用子組件內部的數據,子組件的數據通過slot-scope屬性傳遞到了父組件
怎么做:
<template slot-scope="scope">
<el-tooltip effect="dark" content="修改角色" placement="top" :enterable='false'>
<el-button type="primary" icon="el-icon-edit" size="mini" @click="changeUser(scope.row.id)" ></el-button>
</el-tooltip>
scope會得到當前模板的數據