vue实现聊天框自动滚动
需求
1、聊天数据实时更新渲染到页面
2、页面高度随聊天数据增加而增加
3、竖向滚动
4、当用户输入聊天内容或者接口返回聊天内容渲染在页面后,自动滚动到底部
5、提供点击事件操控滚动条上下翻动
环境依赖
vue:@vue/cli 5.0.8
taro:v3.4.1
实现方案
方案一:元素设置锚点,使用scrollIntoView() 方法滑动
Element 接口的 scrollIntoView() 方法会滚动元素的父容器,使被调用 scrollIntoView() 的元素对用户可见
1、语法
element.scrollIntoView(); // 等同于 element.scrollIntoView(true)
element.scrollIntoView(alignToTop); // alignToTop为Boolean 型参数,true/false
element.scrollIntoView(scrollIntoViewOptions); // Object 型参数
2、参数
(1)alignToTop(可选)
类型:Boolean
如果为true,元素的顶端将和其所在滚动区的可视区域的顶端对齐。对应的 scrollIntoViewOptions: {block: “start”, inline: “nearest”}。该参数的默认值为true。
如果为false,元素的底端将和其所在滚动区的可视区域的底端对齐。对应的scrollIntoViewOptions: {block: “end”, inline: “nearest”}。
(2)scrollIntoViewOptions (可选)
类型:对象
behavior 【可选】
定义动画的过渡效果,取值为 auto/smooth。默认为 “auto”。
block 【可选】
定义垂直方向的对齐, 取值为 start/center/end/nearest 。默认为 “start”。
inline 【可选】
定义水平方向的对齐, 取值为 start/center/end/nearest。默认为 “nearest”。
代码实现如下:
<template><view class="main" id="main"><!-- scroll-y:允许纵向滚动 默认: false | 给scroll-view一个固定高度 | scroll-into-view: 值应为某子元素id(id不能以数字开头)。设置哪个方向可滚动,则在哪个方向滚动到该元素 --><scroll-view class="mainbody" id="mainbody" scroll-with-animation :scroll-y="true" :scroll-into-view="scrollId" style="height:960px;" :enhanced=true scrollIntoViewAlignment="center"@scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll" :scrollWithAnimation="true"><view v-for="(item, index) in contentTypeit.arr" v-bind:key="index":class="['info', 'content-questionBlock']"><view :class="['content']" :id="item.id">{{ item.content}}</view></view><view @click="sendMsg" id="sendMsg"></view><view @click="pageUp" id="pageUp" style="visibility: hidden;"></view><view @click="pageDown" id="pageDown" style="visibility: hidden;"></view></scroll-view></view>
</template><script>
import { ref, reactive, toRaw } from 'vue'export default {setup () {const contentTypeit = reactive({arr: []})const scrollId = ref('id0') //scroll ID值const scrollCursor = ref('id0')const number = ref(0)//https://blog.csdn.net/weixin_43398820/article/details/119963930// 会话内容// 获取对话结果const sendMsg = function () {setContent( 'dfasdfsfsafdsafsafsdfsafsdfsdfdsfsafdsfsadfsafggfdhfhfjgfjhsdgdsfgasfsafdsafsagdhgfhfdhsgdsgdsgdgafsadfdsfdsfsadfhghsdfgsafdsaf')}// 设置对话内容const setContent = function (msg) {let idValue = 'id' + number.valueconst currentObjTypeit = {'content': msg,'id': idValue}let _arr = toRaw(contentTypeit.arr)let _arrTmp = _arr.concat(currentObjTypeit)contentTypeit.arr = _arrTmpnumber.value = number.value + 1;scrollCursor.value = idValue//https://blog.csdn.net/weixin_46511008/article/details/126629361setTimeout(() => {if (number.value !== 0) {let idValueSlide = 'id' + (number.value - 1)document.getElementById(idValueSlide).scrollIntoView({behavior: 'smooth',block: 'center',inline: 'end'})}}, 100);}const scroll = function (e) {// console.log('scroll', e)}const upper = function (e) {// console.log('upper', e)}const lower = function (e) {// console.log('lower', e)}const pageUp = function (e) {console.log(scrollCursor.value)if (scrollCursor.value === undefined || scrollCursor.value === '' || scrollCursor.value.length < 3) {return;}let scrollCursorValue = scrollCursor.value.substring(2);console.log(scrollCursorValue);if (scrollCursorValue >= 1) {scrollCursorValue = scrollCursorValue - 1;scrollCursor.value = 'id' + scrollCursorValue;}setTimeout(function(){if (document.querySelector('#'+ scrollCursor.value) === null) {return;}document.querySelector('#'+ scrollCursor.value).scrollIntoView()}, 200);}const pageDown = function (e) {console.log(scrollCursor.value)if (scrollCursor.value === undefined || scrollCursor.value === '' || scrollCursor.value.length < 3) {return;}let scrollCursorValue = scrollCursor.value.substring(2);console.log(scrollCursorValue);if (scrollCursorValue < contentTypeit.arr.length - 1) {scrollCursorValue = scrollCursorValue - (-1)scrollCursor.value = 'id' + scrollCursorValue;}if (scrollCursorValue === contentTypeit.arr.length - 1) {setTimeout(function(){if (document.querySelector('#'+ scrollCursor.value) === null) {return;}document.querySelector('#'+ scrollCursor.value).scrollIntoView(false)}, 500);} else {setTimeout(function() {if (document.querySelector('#'+ scrollCursor.value) === null) {return;}document.querySelector('#'+ scrollCursor.value).scrollIntoView({behavior: "smooth", // 平滑过渡block: "end", // 上边框与视窗顶部平齐。默认值})}, 100);}}return {contentTypeit,scrollId,lower,upper,scroll,sendMsg,pageUp,pageDown,}}
}
</script><style lang="scss">
.main {height: 100%;width: 100%;background-color: rgba(204, 204, 204, 0.32);overflow-x: hidden;overflow-y: auto;
}.mainbody {max-width: 100%;background-size: contain;padding-bottom: 100px;
}.info {display: flex;margin: 10px 3%;
}
.content-question {color: #0b4eb4;background-color: #ffffff;padding-left: 20px;
}.content-questionBlock {align-items: center;
}.content {background-color: #fff;border-radius: 16px;padding: 20px;margin-left: 20px;max-width: 82%;height: 100%;font-size: 36px;font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;color: #0a0a27;line-height: 60px;word-break: break-all;
}
</style>
效果调试:
(1)打开浏览器,按下F12进入调试模式;
(2)在console窗口,多次调用document.getElementById('sendMsg').click(),使得对话内容超出界面高度,可观察到自动滚动效果;
(3)在console窗口,调用document.getElementById('pageUp').click(),若没有滚动,可调整代码或者调用多次(取决于scrollIntoView()的参数),可观察到向上滚动;接着调用document.getElementById('pageDown').click(),可观察到向下滚动。
效果图如下:
方案二: 更改scrollTop取值,进行滚动
首先我们需要了解 clientHeight、offsetHeight、scrollHeight、scrollTop 的概念
简单介绍:
clientHeight:网页可见区域高
offsetHeight:网页可见区域高(包括边线的高)
scrollHeight:网页正文全文高
scrollTop:网页被卷去的高
具体说明:
(1)clientHeight:包括padding 但不包括 border、水平滚动条、margin的元素的高度。对于inline的元素来说这个属性一直是0,单位px,为只读元素。
简单来说就是——盒子的原始高度,具体可参考下图:
(2)offsetHeight:包括padding、border、水平滚动条,但不包括margin的元素的高度。对于inline的元素来说这个属性一直是0,单位px,为只读元素。
简单来说就是——盒子的原始高度+padding+border+滚动条,具体可参考下图:
(3)scrollHeight:
这个只读属性是一个元素内容高度的度量,包括由于溢出导致的视图中不可见内容。
简单来说就是——盒子里面包含的内容的真实高度,具体可参考下图:
(4)scrollTop: 代表在有滚动条时,滚动条向下滚动的距离也就是元素顶部被遮住部分的高度。在没有滚动条时 scrollTop==0 恒成立。单位px,可读可设置。
MDN解释:一个元素的 scrollTop 值是这个元素的内容顶部(被卷起来的)到它的视口可见内容(的顶部)的距离的度量。当一个元素的内容没有产生垂直方向的滚动条,那它的 scrollTop 值为0,具体可参考下图:
实现算法:卷起的高度(scrollTop) = 总的内容高度(scrollHeight) - 聊天区域盒子大小 (offsetHeight);
代码实现如下:
<template><view class="main" ref="scrollContainer" id="main"><!-- scroll-y:允许纵向滚动 默认: false | 给scroll-view一个固定高度 --><scroll-view class="mainbody" id="mainbody" scroll-with-animation :scroll-y="true" style="height:960px;" :enhanced=true scrollIntoViewAlignment="center"@scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll" :scrollWithAnimation="true"><view v-for="(item, index) in contentTypeit.arr" v-bind:key="index":class="['info', 'content-questionBlock']"><view :class="['content']" :id="item.id">{{ item.content}}</view></view><view @click="sendMsg" id="sendMsg"></view><view @click="pageUp" id="pageUp" style="visibility: hidden;"></view><view @click="pageDown" id="pageDown" style="visibility: hidden;"></view></scroll-view></view>
</template><script>
import { ref, reactive, toRaw } from 'vue'
import Taro from "@tarojs/taro";export default {setup () {const contentTypeit = reactive({arr: []})const scrollId = ref('id0') //scroll ID值const scrollCursor = ref('id0')const scrollCursorStore = ref(0)// 自动 scrollTop//https://www.cnblogs.com/hmy-666/p/14717484.html 滚动原理与实现//由于插入新的消息属于创建新的元素的过程,这个过程是属于异步的,所以为了防止异步创建元素导致获取高度不准确,我们可以等待一段时间,等元素创建完毕之后再获取元素高度const scrollDownInterval = function () {let idDom = document.getElementById('mainbody')console.log("===================scrollTop,clientHeight,scrollHeight,offsetHeight", idDom.scrollTop, idDom.clientHeight, idDom.scrollHeight, idDom.offsetHeight)let currentScrollPosition = scrollCursorStore.value;Taro.nextTick(() => {console.log('scroll start...', idDom.scrollTop)let scrollInterval = setInterval(() => {if ((idDom.scrollTop === idDom.scrollHeight - idDom.offsetHeight) ||(idDom.scrollTop > idDom.scrollHeight - idDom.offsetHeight)) {scrollCursorStore.value = idDom.scrollTopclearInterval(scrollInterval);console.log('scroll end...', idDom.scrollTop)} else {currentScrollPosition =currentScrollPosition + 100;idDom.scrollTop = currentScrollPosition;scrollCursorStore.value = idDom.scrollTopconsole.log('scrolling...', idDom.scrollTop)}}, 200)})}const number = ref(0)//https://blog.csdn.net/weixin_43398820/article/details/119963930// 会话内容// 获取对话结果const sendMsg = function () {setContent( 'dfasdfsfsafdsafsafsdfsafsdfsdfdsfsafdsfsadfsafggfdhfhfjgfjhsdgdsfgasfsafdsafsagdhgfhfdhsgdsgdsgdgafsadfdsfdsfsadfhghsdfgsafdsaf')}// 设置对话内容const setContent = function (msg) {let idValue = 'id' + number.valueconst currentObjTypeit = {'content': msg,'id': idValue}let _arr = toRaw(contentTypeit.arr)let _arrTmp = _arr.concat(currentObjTypeit)contentTypeit.arr = _arrTmpnumber.value = number.value + 1;scrollCursor.value = idValue//https://blog.csdn.net/weixin_46511008/article/details/126629361scrollDownInterval();}const scroll = function (e) {// console.log('scroll', e)}const upper = function (e) {// console.log('upper', e)}const lower = function (e) {// console.log('lower', e)}const pageUp = function (e) {let idDom = document.getElementById('mainbody')console.log("===================", idDom.scrollTop, idDom.clientHeight, idDom.scrollHeight, idDom.offsetHeight)let currentScrollPosition = scrollCursorStore.value;scrollCursorStore.value = scrollCursorStore.value - 400if (scrollCursorStore.value < 0) {scrollCursorStore.value = 0;}Taro.nextTick(() => {console.log('scroll start...', idDom.scrollTop)let scrollInterval = setInterval(() => {if ((idDom.scrollTop === scrollCursorStore.value) ||(idDom.scrollTop < scrollCursorStore.value)) {clearInterval(scrollInterval);console.log('scroll end...', idDom.scrollTop)} else {currentScrollPosition =currentScrollPosition - 50;idDom.scrollTop = currentScrollPosition;console.log('scrolling...', idDom.scrollTop)}}, 100)})}const pageDown = function (e) {let idDom = document.getElementById('mainbody')console.log("===================", idDom.scrollTop, idDom.clientHeight, idDom.scrollHeight, idDom.offsetHeight)let currentScrollPosition = scrollCursorStore.value;scrollCursorStore.value = scrollCursorStore.value + 400if (scrollCursorStore.value > (idDom.scrollHeight - idDom.offsetHeight )) {scrollCursorStore.value = idDom.scrollHeight - idDom.offsetHeight;}Taro.nextTick(() => {console.log('scroll start...', idDom.scrollTop)let scrollInterval = setInterval(() => {if ((idDom.scrollTop === scrollCursorStore.value) ||(idDom.scrollTop > scrollCursorStore.value)) {clearInterval(scrollInterval);console.log('scroll end...', idDom.scrollTop)} else {currentScrollPosition =currentScrollPosition - (-50);idDom.scrollTop = currentScrollPosition;console.log('scrolling...', idDom.scrollTop)}}, 100)})}return {contentTypeit,scrollId,lower,upper,scroll,sendMsg,pageUp,pageDown,}}
}
</script><style lang="scss">
.main {height: 100%;width: 100%;background-color: rgba(204, 204, 204, 0.32);overflow-x: hidden;overflow-y: auto;
}.mainbody {max-width: 100%;background-size: contain;padding-bottom: 100px;
}.info {display: flex;margin: 10px 3%;
}
.content-question {color: #0b4eb4;background-color: #ffffff;padding-left: 20px;
}.content-questionBlock {align-items: center;
}.content {background-color: #fff;border-radius: 16px;padding: 20px;margin-left: 20px;max-width: 82%;height: 100%;font-size: 36px;font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;color: #0a0a27;line-height: 60px;word-break: break-all;
}
</style>
效果调试:
(1)打开浏览器,按下F12进入调试模式;
(2)在console窗口,多次调用document.getElementById('sendMsg').click(),使得对话内容超出界面高度,可观察到自动滚动效果;
(3)在console窗口,调用document.getElementById('pageUp').click(),可观察到向上滚动;接着调用document.getElementById('pageDown').click(),可观察到向下滚动。
效果图如下:
建议
方案一由于接口支持,滑动效果更平滑,但是翻页只能调到指定锚点,滑动步长不可控,大部分场景不能满足需求。
方案二可以自行调整翻页的步长,按需滑动至指定高度,不过滑动动画需要自行实现,看起来卡顿感较强。
总体来说,建议使用方案二。
参考链接:
https://blog.csdn.net/weixin_46511008/article/details/126629361
https://www.cnblogs.com/wq805/p/16399600.html
https://www.cnblogs.com/hmy-666/p/14717484.html
Taro 文档
相关文章:

vue实现聊天框自动滚动
需求 1、聊天数据实时更新渲染到页面 2、页面高度随聊天数据增加而增加 3、竖向滚动 4、当用户输入聊天内容或者接口返回聊天内容渲染在页面后,自动滚动到底部 5、提供点击事件操控滚动条上下翻动 环境依赖 vue:vue…...
项目中遇到的一些问题总结(六)
Minio Minio是一个开源的分布式对象存储系统,它使用纠删码技术来保护数据。纠删码技术是一种恢复丢失和损坏数据的数学算法,它将数据分块冗余的分散存储在各个节点的磁盘上,从而提供了一定程度的数据可靠性和冗余性。 在Minio中,…...

Linux线程5——生产消费模型
生产消费模型 1个交易场所:超市 2种角色:生产者/消费者 3种关系:生产者和生产者(竞争关系也叫互斥关系),消费者和消费者(竞争关系同样是互斥关系),生产者和消费者(互斥,同步关系:生产完再消费或消费完再生产)。 以上是生产消费模型遵守的“321”原则。 生产者和消…...
Vue + Springboot 文件上传项目笔记(一)
Vue Springboot 文件上传项目笔记(一) 前端 使用脚手架创建项目 vue create vue_fileuploaddemo等待命令执行完毕添加 element-ui 组件 E:\java\idea_java_maven\vue_fileuploaddemo>yarn add element-ui yarn add v1.22.19 [1/4] Resolving pac…...
【华为OD机试真题2023B卷 JAVA】座位调整
华为OD2023(B卷)机试题库全覆盖,刷题指南点这里 座位调整 知识点迭代 时间限制:1s 空间限制:256MB 限定语言:C(clang11), C++(clang++11), Java(javac 1.8), Python3(3.9), JavaScript Node(12.18.2), Go(1.14.4) 题目描述: 疫情期间课堂的座位进行了特殊的调整,不能出…...

Python 学习 2022.08.28 周日
文章目录 一、 概述1.1) 之前写的文章:1.2) 基础点1.3) 配置1.4) Python2 和 Python3 的区别1.5) 相关问题跟踪解决1.6) 其他 一、 概述 1.1) 之前写的文章: 【Python大系】Python快速教程《Python 数据库 GUI CGI编…...

WEB自动化测试,一定得掌握的8个核心知识点
编辑 写在前面 使用 cypress 进行端对端测试,和其他的一些框架有一个显著不同的地方,它使用 JavaScript 作为编程语言。 传统主流的 selenium 框架是支持多语言的,大多数 QA 会的 python 和 Java 语言都可以编写 selenium 代码࿰…...

期末复习总结!!【MySQL】库和表的基本操作 + 增删改查CURD
文章目录 前言一、数据库的基本操作1, 查看库2, 创建库3, 使用库4, 删除库 二、表的基本操作1, 创建表2, 查看表3, 查看表结构4, 删除表 三、增加(Create)四、查询(Retrieve) (重点)1, 全列查询2, 指定列查询3, 查询字段为表达式4, 指定别名5, 去重6, 排序7, 条件查询7.1, 基本…...

线上问题处理案例:出乎意料的数据库连接池 | 京东云技术团队
导读 本文是线上问题处理案例系列之一,旨在通过真实案例向读者介绍发现问题、定位问题、解决问题的方法。本文讲述了从垃圾回收耗时过长的表象,逐步定位到数据库连接池保活问题的全过程,并对其中用到的一些知识点进行了总结。 一、问题描述…...

有了 IP 地址,为什么还要用 MAC 地址?
MAC地址等价于快递包裹上的收件人姓名。 MAC地址更多是用于确认对方信息而存在的。就如同快递跨越几个城市来到你面前,快递员需要和你确认一下收件人是否正确,才会把包裹交给你一样。 IP66在线查IP地址位置:https://www.ip66.net/?utm-sour…...

ChatGPT 推出 iOS 应用,支持语音输入,使用体验如何?
最近,OpenAI 宣布推出官方 iOS 应用,允许用户随时随地访问其高人气 AI 聊天机器人,此举也打破了近几个月内苹果 App Store 上充斥似是而非的山寨服务的窘境。 该应用程序是 ChatGPT 的首个官方移动应用程序。ChatGPT 软件程序在去年推出后迅速…...

【科普】干货!带你从0了解移动机器人(二)—— 移动机器人硬件组成
移动机器人是一个多功能于一体的综合系统,内容涵盖了传感器技术、自动化技术、信息处理、电子工程等,它集环境感知、动态决策与规划于一体,是目前科学技术发展最活跃的领域之一。移动机器人的各种组件之间需要协同工作才能实现机器人的自主移…...

WIN提权 令牌窃取进程注入
令牌窃取(鸡肋玩意 2008包括2008以下) 令牌,又叫token,是系统临时产生的秘钥,相当于账号密码,用来决定是否允许此次请求和判断此次请求是属于哪一个用户。 win7一下的版本可以尝试 这里使用msf上自带的令…...
CSS 提高性能的方法,并提供一些实用的技巧和代码示例
CSS 是前端开发中不可或缺的一部分,它负责网页的样式和布局。随着网站规模和复杂度的增加,CSS 的性能也变得越来越重要。本文将介绍 CSS 提高性能的方法,并提供一些实用的技巧和代码示例。 使用压缩后的 CSS 文件 压缩 CSS 文件可以减小文件…...

程序员:面试造火箭,入职拧螺丝?太难了···
刚开始工作的时候,我也想不通这个问题,甚至很鄙视这种现象。后面当了面试官,做到了公司中层管理,也会站在公司以及行业角度去重新思考这个问题。 为什么这种现象会越来越普遍呢?尤其在 IT 行业愈加明显。 面试看的是…...

pg事务:隔离级别历史与SSI
事务隔离级别的历史 ANSI SQL-92定义的隔离级别和异常现象确实对数据库行业影响深远,甚至30年后的今天,绝大部分工程师对事务隔离级别的概念还停留在此,甚至很多真实的数据库隔离级别实现也停留在此。但后ANSI92时代对事物隔离有许多讨论甚至…...
【滑动窗口】【单调队列】个人练习-Leetcode-2373. Largest Local Values in a Matrix
题目链接:https://leetcode.cn/problems/largest-local-values-in-a-matrix/ 题目大意:给出一个N*N矩阵,要求做池化操作,选出每个3*3矩阵的最大值,返回一个(N-2)*(N-2)矩阵 思路:这是个简单题,…...

工厂蓝牙定位技术的原理、应用场景、优势及潜在问题
蓝牙定位技术是近年来在工业领域中得到广泛应用的一项技术。随着工业自动化的快速发展和物联网技术的普及,工厂蓝牙定位成为了提高生产效率、优化生产流程和管理的重要工具。本文将详细介绍工厂蓝牙定位技术的原理、应用场景以及其在工业生产中的优势。 首先&#x…...

Linux内核模块编程
访问【WRITE-BUG数字空间】_[内附完整源码和文档] 1 总体设计思路 Linux内核是单体式结构,相对于微内核结构而言,其运行效率高,但是系统的可维护性和可扩展性较差。为此,Linux提供了内核模块(module)机制&…...

每日一练 | 网络工程师软考真题 Day8
1、某客户端采用ping命令检测网络连接故障时,发现可以ping通127.0.0.1及本机的IP地址,但无法ping通同一网段内其他工作正常的计算机的IP地址。该客户端的故障可能是 。 A.TCP/IP协议不能正常工作 B.本机网卡不能正常工作 …...

网络编程(Modbus进阶)
思维导图 Modbus RTU(先学一点理论) 概念 Modbus RTU 是工业自动化领域 最广泛应用的串行通信协议,由 Modicon 公司(现施耐德电气)于 1979 年推出。它以 高效率、强健性、易实现的特点成为工业控制系统的通信标准。 包…...

大数据学习栈记——Neo4j的安装与使用
本文介绍图数据库Neofj的安装与使用,操作系统:Ubuntu24.04,Neofj版本:2025.04.0。 Apt安装 Neofj可以进行官网安装:Neo4j Deployment Center - Graph Database & Analytics 我这里安装是添加软件源的方法 最新版…...
《Playwright:微软的自动化测试工具详解》
Playwright 简介:声明内容来自网络,将内容拼接整理出来的文档 Playwright 是微软开发的自动化测试工具,支持 Chrome、Firefox、Safari 等主流浏览器,提供多语言 API(Python、JavaScript、Java、.NET)。它的特点包括&a…...

什么是库存周转?如何用进销存系统提高库存周转率?
你可能听说过这样一句话: “利润不是赚出来的,是管出来的。” 尤其是在制造业、批发零售、电商这类“货堆成山”的行业,很多企业看着销售不错,账上却没钱、利润也不见了,一翻库存才发现: 一堆卖不动的旧货…...

现代密码学 | 椭圆曲线密码学—附py代码
Elliptic Curve Cryptography 椭圆曲线密码学(ECC)是一种基于有限域上椭圆曲线数学特性的公钥加密技术。其核心原理涉及椭圆曲线的代数性质、离散对数问题以及有限域上的运算。 椭圆曲线密码学是多种数字签名算法的基础,例如椭圆曲线数字签…...
Java入门学习详细版(一)
大家好,Java 学习是一个系统学习的过程,核心原则就是“理论 实践 坚持”,并且需循序渐进,不可过于着急,本篇文章推出的这份详细入门学习资料将带大家从零基础开始,逐步掌握 Java 的核心概念和编程技能。 …...

C++ Visual Studio 2017厂商给的源码没有.sln文件 易兆微芯片下载工具加开机动画下载。
1.先用Visual Studio 2017打开Yichip YC31xx loader.vcxproj,再用Visual Studio 2022打开。再保侟就有.sln文件了。 易兆微芯片下载工具加开机动画下载 ExtraDownloadFile1Info.\logo.bin|0|0|10D2000|0 MFC应用兼容CMD 在BOOL CYichipYC31xxloaderDlg::OnIni…...
Rapidio门铃消息FIFO溢出机制
关于RapidIO门铃消息FIFO的溢出机制及其与中断抖动的关系,以下是深入解析: 门铃FIFO溢出的本质 在RapidIO系统中,门铃消息FIFO是硬件控制器内部的缓冲区,用于临时存储接收到的门铃消息(Doorbell Message)。…...

云原生玩法三问:构建自定义开发环境
云原生玩法三问:构建自定义开发环境 引言 临时运维一个古董项目,无文档,无环境,无交接人,俗称三无。 运行设备的环境老,本地环境版本高,ssh不过去。正好最近对 腾讯出品的云原生 cnb 感兴趣&…...
在QWebEngineView上实现鼠标、触摸等事件捕获的解决方案
这个问题我看其他博主也写了,要么要会员、要么写的乱七八糟。这里我整理一下,把问题说清楚并且给出代码,拿去用就行,照着葫芦画瓢。 问题 在继承QWebEngineView后,重写mousePressEvent或event函数无法捕获鼠标按下事…...