element的el-table表格自定义表头,<template #header> slot="header"内,表格在触发事件,this的数据更改后会重置成原来的数据问题
<template header>
<div @clikc="checkTab('all')" >全部</div>
<div @clikc="checkTab('hot')" >热门</div>
</template>
这里的checkTab方法做的操作是更改一个状态为传入的值,但是点击热门后还是 all,所以把template header加一个# 后就不会刷新成原来的了,如下
<template #header>
<div @clikc="checkTab('all')" >全部</div>
<div @clikc="checkTab('hot')" >热门</div>
</template>