<!-- 官网案例 -->
<el-table-column align="right">
<template slot="header" slot-scope="scope">
<el-input
v-model="search"
size="mini"
placeholder="输入关键字搜索"/>
</template>
<template slot-scope="scope">
<el-button
size="mini"
@click="handleEdit(scope.$index, scope.row)">Edit</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">Delete</el-button>
</template>
</el-table-column>
element官网中自定义表头案例如上,在使用过程中,感觉没有用到作用域插槽slot-scope="scope"
,而且eslint
校验此处报红,所以就把他去掉了。在后来使用中出现了诡异的一幕,输入框无论如何都不能输入内容。刚开始以为是输入框有问题,各种查找、移除、对比,才发现因为移除掉了作用域插槽有了影响。但现在如果加上他就会报红,通过网上搜索可以这样写:
<template slot="header" slot-scope="/* eslint-disable vue/no-unused-vars */ scope">
</template>