前言
22届毕业生 4月9号百度一面
请说出他的打印结果 为什么?
async function async1() {
console.log('async1 start');
await async2();
console.log('async1 end');
}
async function async2() {
console.log('async2');
}
console.log('script start');
setTimeout(function() {
console.log('setTimeout');
}, 0);
window.requestAnimationFrame(() => {console.log('Raf')});
async1();
new Promise(function(resolve) {
console.log('promise1');
resolve();
}).then(function() {
console.log('promise2');
});
console.log('script end');
答案:
使用递归算法将省过滤掉
大家有什么好的方法可以分享出来
let arr =[
{
id: 1000,
label: '中国',
children: [
{
id: 16,
label: '湖北',
children: [
{
id: 371,
label: '武汉',
}
]
}
]
},
{
id: 1001,
label: '国外',
children: [
{
id: 7,
label: '日本'
},
{
id: 37,
label: '其他国家'
}
]
}
]
答案:
function filter(arr, childrenLeight, number = 1) {
if (number == childrenLeight) {
return null
} else {
arr.map((item) => {
if (item.children) {
item.children = filter(item.children, childrenLeight, number+1)
}
})
}
return arr
}
自我介绍
你项目中使用到的亮点
使用element-plus中的table 渲染一组数据
[
{
id: 123412,
name: 'BOT1',
imgurl: 'https://ecmb.bdimg.com/lottie/prod/7fd674741983b2a1/1703731421779/6E6C4472F321E4C76A22CEFE8.png'
},
{
id: 123414,
name: '大众数字人',
imgurl: 'https://ecmb.bdimg.com/lottie/prod/7fd674741983b2a1/1703731421779/6E6C4472F321E4C76A22CEFE8.png'
},
{
id: 123499,
name: 'DIY数字人非官方的个大范甘迪个非官方的',
imgurl: 'https://ecmb.bdimg.com/lottie/prod/7fd674741983b2a1/1703731421779/6E6C4472F321E4C76A22CEFE8.png'
}
]
前端向后端传递数据时 如果有个key对应的值是个数组 前端需要怎么处理?
这个可能我没理解对 他的意思 我说不用处理 哈哈哈哈哈哈哈哈哈
数据是怎样渲染到页面上的
响应式原理
数组可以实现响应式吗 我通过索引操作数据,又想视图更新怎么办
你有使用过那些构建工具
vite的构建流程
plugin和loader的区别
loader相当于文件转换器,plugin相当于一个插件。一个用于文件转换,一个提供功能 loader运行在打包前 plugin在整个编译过程中都起作用