2024年vue移动端直播评论功能实现,面试过往经历中最有成就感的一件事

文末

逆水行舟不进则退,所以大家要有危机意识。

同样是干到35岁,普通人写业务代码划水,榜样们深度学习拓宽视野晋升管理。

这也是为什么大家都说35岁是程序员的门槛,很多人迈不过去,其实各行各业都是这样都会有个坎,公司永远都缺的高级人才,只用这样才能在大风大浪过后,依然闪耀不被公司淘汰不被社会淘汰。

为了帮助大家更好温习重点知识、更高效的准备面试,特别整理了《前端工程师核心知识笔记》电子稿文件。

内容包括html,css,JavaScript,ES6,计算机网络,浏览器,工程化,模块化,Node.js,框架,数据结构,性能优化,项目等等。

269页《前端大厂面试宝典》

包含了腾讯、字节跳动、小米、阿里、滴滴、美团、58、拼多多、360、新浪、搜狐等一线互联网公司面试被问到的题目,涵盖了初中级前端技术点。

开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】

前端面试题汇总

this.queue(data);

setTimeout(() => {

const list = new Array(10).fill(“”);

this.queue(list);

}, 30000);

},

methods: {

initDom() {

this.wrapperDom = this.$refs.wrapper;

this.listDom = this.$refs.list;

this.wrapperHeight = this.wrapperDom.offsetHeight;

},

addTimeOut(opt) {

return new Promise((resolve, reject) => {

setTimeout(() => {

this.addComment(opt);

resolve();

}, 500);

});

},

// 队列添加消息

async queue(data) {

for (let i = 0; i < data.length; i++) {

const opt = {

name: iiiii*i + “-用户名”,

content: iiiii*i + “-评论内容”,

id: Date.now()

};

await this.addTimeOut(opt);

}

},

addScroll() {

debounce(this.listScroll, 200);

this.isBindScrolled = true;

},

listScroll() {

const ele = this.wrapperDom;

const isBottom = isScrollBottom(ele, ele.clientHeight);

if (isBottom) {

this.restNums = 0;

this.restComment = 0;

}

},

// 添加评论 如果超过150条就将前50条删除

addComment(data) {

if (this.list.length >= 150) {

this.list.splice(0, 50);

}

this.list.push(data);

this.$nextTick(() => {

this.renderComment();

});

},

// 渲染评论

renderComment() {

const listHight = this.listDom.offsetHeight;

const diff = listHight - this.wrapperHeight; // 列表高度与容器高度差值

const top = this.wrapperDom.scrollTop; // 列表滚动高度

if (diff - top < this.listDom.lastElementChild.offsetHeight*1.5) {

if (diff > 0) {

if (this.isBindScrolled) {

this.isBindScrolled = false;

this.wrapperDom.removeEventListener(“scroll”, this.addScroll);

}

this.wrapperDom.scrollTo({

top: diff + 10,

left: 0,

behavior: “smooth”

});

this.restNums = 0;

}

} else {

++this.restNums;

if (!this.isBindScrolled) {

this.isBindScrolled = true;

this.wrapperDom.addEventListener(“scroll”, this.addScroll);

}

}

this.restComment = this.restNums >= 99 ? “99+” : this.restNums;

},

// 滚动到底部

scrollBottom() {

this.restNums = 0; // 清除剩余消息

this.restComment = this.restNums;

this.wrapperDom.scrollTo({

top: this.listDom.offsetHeight,

left: 0,

behavior: “smooth”

});

}

}

};

  • 29
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值