值相同
==
类型和值都相同
===
index.vue
callback: (type) => {
console.log("type->",typeof type);
if (type && type == 0) {
return "直女";
} else if (type && type == 1) {
return "直男";
}
},
table.vue
<el-table-column
v-else-if="item.type === 'function'"
:key="item.prop"
:label="item.label"
:prop="item.prop"
:width="item.width"
>
<template slot-scope="scope">
<!-- item.callback(scope.row) 把数据传出去 scope.row == data -->
<span>{{item.callback && item.callback(scope.row.type)}}</span>
</template>
</el-table-column>
console 控制台打印
type-> string