饿了吗(element UI)表格
1.表格自定义表头不能用
<template slot="header" slot-scope="/* eslint-disable vue/no-unused-vars */ scope">
</template>
有很大的原因是eslint导致的,添加slot-scope="/* eslint-disable vue/no-unused-vars */ scope"就可以解决,不要轻易改动eslint
2.实践
<sg-table-column align="center">
<template slot="header" slot-scope="/* eslint-disable vue/no-unused-vars */ scope">
<sg-switch
v-model="allStatus"
active-text="是"
inactive-text="否"
@change="allStatusChange"
></sg-switch>
</template>
<template slot-scope="scope">
<sg-switch
@change="switchChange(scope.row)"
v-model="scope.row.taskStatus"
active-value="0"
inactive-value="1"
active-text="是"
inactive-text="否"
></sg-switch>
</template>
</sg-table-column>```
data() {
return {
allStatus: false,
}
}