面试复盘

# 在 vue 中如何在 el 组件的基础上自定义组件,并全功能继承原有的组件方法与属性

  1. ​​属性透传​
1
2
3
<template>
<el-input v-bind="$attrs" />
</template>
  1. 事件透传
1
2
3
<template>
<el-input v-on="$listeners" />
</template>


3. 插槽透传
Vue 2​​:需区分 $slots(普通插槽)和 $scopedSlots(作用域插槽)。
​​Vue 3​​:所有插槽统一通过 $slots 处理

1
2
3
4
5
6
7
8
<template>
<el-input v-bind="$attrs">
<!-- 遍历所有插槽并渲染 -->
<template v-for="(_, slotName) in $slots" #[slotName]="scope">
<slot :name="slotName" v-bind="scope" />
</template>
</el-input>
</template>
  1. 方法透传
1
2
3
4
5
import { ref, onMounted } from 'vue';
const internalRef = ref(null);
onMounted(() => {
defineExpose({ ...internalRef.value });
});

# 全局配置样式

element-variables.scss

config-provider
el-config-provider
a-config-provider

# 权限控制

# ant-design 和 element-ui

功能支持:ant-design 开源没有虚拟列表
细节: ant-design 的日期范围组件只能从开始选到结束

# 虚拟列表

# 人脸识别

  1. 获取人脸特征、人脸比对
  2. 活体检测