当前位置: 首页 > article >正文

vue-seamless-scroll 结束从头开始,加延时后滚动

今天遇到一个大屏需求:
1️⃣初始进入页面停留5秒,然后开始滚动

2️⃣最后一条数据出现在最后一行时候暂停5秒,然后返回1️⃣

依次循环,发现vue-seamless-scroll的方法 ScrollEnd是监测最后一条数据消失在第一行才回调,不能满足我的需求,于是在node_modules里面找到他的文件重写

主要优化点

// 上

 if (Math.abs(this.yPos) >= this.realBoxHeight - 520) 

this.realBoxHeight是你所有数据加起来的行高, 520是可视区域的行高, yPos是向上滚动的距离,是个负值,滚动了一行,假设行高40,那就是  -40

 // 到达底部时暂停5秒

              this._stopMove()

              setTimeout(() => {

                this.yPos = 0

                // 重置位置后也暂停5秒再开始滚动

                setTimeout(() => {

                  this._startMove()

                }, 5000)

              }, 5000)

我修改完成的文件

<template><div ref="wrap"><div:style="leftSwitch"v-if="navigation":class="leftSwitchClass"@click="leftSwitchClick"><slot name="left-switch"></slot></div><div:style="rightSwitch"v-if="navigation":class="rightSwitchClass"@click="rightSwitchClick"><slot name="right-switch"></slot></div><divref="realBox":style="pos"@mouseenter="enter"@mouseleave="leave"@touchstart="touchStart"@touchmove="touchMove"@touchend="touchEnd"><div ref="slotList" :style="float"><slot></slot></div><div v-html="copyHtml" :style="float"></div></div></div>
</template><script>
require('comutils/animationFrame')()
const arrayEqual = require('comutils/arrayEqual')
const copyObj = require('comutils/copyObj')
export default {name: 'vue-seamless-scroll',data() {return {xPos: 0,yPos: 0,delay: 0,copyHtml: '',height: 0,width: 0, // 外容器宽度realBoxWidth: 0 // 内容实际宽度}},props: {data: {type: Array,default: () => {return []}},classOption: {type: Object,default: () => {return {}}}},computed: {leftSwitchState() {return this.xPos < 0},rightSwitchState() {return Math.abs(this.xPos) < this.realBoxWidth - this.width},leftSwitchClass() {return this.leftSwitchState ? '' : this.options.switchDisabledClass},rightSwitchClass() {return this.rightSwitchState ? '' : this.options.switchDisabledClass},leftSwitch() {return {position: 'absolute',margin: `${this.height / 2}px 0 0 -${this.options.switchOffset}px`,transform: 'translate(-100%,-50%)'}},rightSwitch() {return {position: 'absolute',margin: `${this.height / 2}px 0 0 ${this.width +this.options.switchOffset}px`,transform: 'translateY(-50%)'}},float() {return this.isHorizontal? { float: 'left', overflow: 'hidden' }: { overflow: 'hidden' }},pos() {return {transform: `translate(${this.xPos}px,${this.yPos}px)`,transition: `all ${this.ease} ${this.delay}ms`,overflow: 'hidden'}},defaultOption() {return {step: 0.25, //步长limitMoveNum: 14, //启动无缝滚动最小数据数hoverStop: true, //是否启用鼠标hover控制direction: 1, // 0 往下 1 往上 2向左 3向右openTouch: true, //开启移动端touchsingleHeight: 0, //单条数据高度有值hoverStop关闭singleWidth: 0, //单条数据宽度有值hoverStop关闭waitTime: 1000, //单步停止等待时间switchOffset: 30,autoPlay: true,navigation: false,switchSingleStep: 134,switchDelay: 400,switchDisabledClass: 'disabled',isSingleRemUnit: false // singleWidth/singleHeight 是否开启rem度量}},options() {return copyObj({}, this.defaultOption, this.classOption)},navigation() {return this.options.navigation},autoPlay() {if (this.navigation) return falsereturn this.options.autoPlay},scrollSwitch() {return this.data.length >= this.options.limitMoveNum},hoverStopSwitch() {return this.options.hoverStop && this.autoPlay && this.scrollSwitch},canTouchScroll() {return this.options.openTouch},isHorizontal() {return this.options.direction > 1},baseFontSize() {return this.options.isSingleRemUnit? parseInt(window.getComputedStyle(document.documentElement, null).fontSize): 1},realSingleStopWidth() {return this.options.singleWidth * this.baseFontSize},realSingleStopHeight() {return this.options.singleHeight * this.baseFontSize},step() {let singleSteplet step = this.options.stepif (this.isHorizontal) {singleStep = this.realSingleStopWidth} else {singleStep = this.realSingleStopHeight}if (singleStep > 0 && singleStep % step > 0) {console.error('如果设置了单步滚动,step需是单步大小的约数,否则无法保证单步滚动结束的位置是否准确。~~~~~')}return step}},methods: {reset() {this._cancle()this._initMove()},leftSwitchClick() {if (!this.leftSwitchState) return// 小于单步距离if (Math.abs(this.xPos) < this.options.switchSingleStep) {this.xPos = 0return}this.xPos += this.options.switchSingleStep},rightSwitchClick() {if (!this.rightSwitchState) return// 小于单步距离if (this.realBoxWidth - this.width + this.xPos <this.options.switchSingleStep) {this.xPos = this.width - this.realBoxWidthreturn}this.xPos -= this.options.switchSingleStep},_cancle() {cancelAnimationFrame(this.reqFrame || '')},touchStart(e) {if (!this.canTouchScroll) returnlet timerconst touch = e.targetTouches[0] //touches数组对象获得屏幕上所有的touch,取第一个touchconst { waitTime, singleHeight, singleWidth } = this.optionsthis.startPos = {x: touch.pageX,y: touch.pageY} //取第一个touch的坐标值this.startPosY = this.yPos //记录touchStart时候的posYthis.startPosX = this.xPos //记录touchStart时候的posXif (!!singleHeight && !!singleWidth) {if (timer) clearTimeout(timer)timer = setTimeout(() => {this._cancle()}, waitTime + 20)} else {this._cancle()}},touchMove(e) {//当屏幕有多个touch或者页面被缩放过,就不执行move操作if (!this.canTouchScroll ||e.targetTouches.length > 1 ||(e.scale && e.scale !== 1))returnconst touch = e.targetTouches[0]const { direction } = this.optionsthis.endPos = {x: touch.pageX - this.startPos.x,y: touch.pageY - this.startPos.y}event.preventDefault() //阻止触摸事件的默认行为,即阻止滚屏const dir = Math.abs(this.endPos.x) < Math.abs(this.endPos.y) ? 1 : 0 //dir,1表示纵向滑动,0为横向滑动if (dir === 1 && direction < 2) {// 表示纵向滑动 && 运动方向为上下this.yPos = this.startPosY + this.endPos.y} else if (dir === 0 && direction > 1) {// 为横向滑动 && 运动方向为左右this.xPos = this.startPosX + this.endPos.x}},touchEnd() {if (!this.canTouchScroll) returnlet timerconst direction = this.options.directionthis.delay = 50if (direction === 1) {if (this.yPos > 0) this.yPos = 0} else if (direction === 0) {let h = (this.realBoxHeight / 2) * -1if (this.yPos < h) this.yPos = h} else if (direction === 2) {if (this.xPos > 0) this.xPos = 0} else if (direction === 3) {let w = this.realBoxWidth * -1if (this.xPos < w) this.xPos = w}if (timer) clearTimeout(timer)timer = setTimeout(() => {this.delay = 0this._move()}, this.delay)},enter() {if (this.hoverStopSwitch) this._stopMove()},leave() {if (this.hoverStopSwitch) this._startMove()},_move() {// 鼠标移入时拦截_move()if (this.isHover) returnthis._cancle() //进入move立即先清除动画 防止频繁touchMove导致多动画同时进行this.reqFrame = requestAnimationFrame(function() {const h = this.realBoxHeight / 2 //实际高度const w = this.realBoxWidth / 2 //宽度let { direction, waitTime } = this.optionslet { step } = thisif (direction === 1) {// 上if (Math.abs(this.yPos) >= this.realBoxHeight - 520) {this.$emit('ScrollEnd')// 到达底部时暂停5秒this._stopMove()setTimeout(() => {this.yPos = 0// 重置位置后也暂停5秒再开始滚动setTimeout(() => {this._startMove()}, 5000)}, 5000)return}this.yPos -= step} else if (direction === 0) {// 下if (this.yPos >= 0) {this.$emit('ScrollEnd')// 到达顶部时暂停5秒this._stopMove()setTimeout(() => {this.yPos = h * -1// 重置位置后也暂停5秒再开始滚动setTimeout(() => {this._startMove()}, 5000)}, 5000)return}this.yPos += step} else if (direction === 2) {// 左if (Math.abs(this.xPos) >= w) {this.$emit('ScrollEnd')// 到达左边界时暂停5秒this._stopMove()setTimeout(() => {this.xPos = 0// 重置位置后也暂停5秒再开始滚动setTimeout(() => {this._startMove()}, 5000)}, 5000)return}this.xPos -= step} else if (direction === 3) {// 右if (this.xPos >= 0) {this.$emit('ScrollEnd')// 到达右边界时暂停5秒this._stopMove()setTimeout(() => {this.xPos = w * -1// 重置位置后也暂停5秒再开始滚动setTimeout(() => {this._startMove()}, 5000)}, 5000)return}this.xPos += step}// 移除单步滚动逻辑,改为连续滚动this._move()}.bind(this))},_initMove() {this.$nextTick(() => {const { switchDelay } = this.optionsconst { autoPlay, isHorizontal } = thisthis._dataWarm(this.data)this.copyHtml = '' //清空copyif (isHorizontal) {this.height = this.$refs.wrap.offsetHeightthis.width = this.$refs.wrap.offsetWidthlet slotListWidth = this.$refs.slotList.offsetWidththis.$refs.realBox.style.width = slotListWidth + 'px'this.realBoxWidth = slotListWidth}if (autoPlay) {this.ease = 'ease-in'this.delay = 0} else {this.ease = 'linear'this.delay = switchDelayreturn}// 是否可以滚动判断if (this.scrollSwitch) {let timerif (timer) clearTimeout(timer)this.realBoxHeight = this.$refs.realBox.offsetHeight// 初始化时暂停5秒后开始滚动setTimeout(() => {this._move()}, 5000)} else {this._cancle()this.yPos = this.xPos = 0}})},_dataWarm(data) {if (data.length > 100) {console.warn(`数据达到了${data.length}条有点多哦~,可能会造成部分老旧浏览器卡顿。`)}},_startMove() {this.isHover = false //开启_movethis._move()},_stopMove() {this.isHover = true //关闭_movethis._cancle()}},watch: {data(newData, oldData) {this._dataWarm(newData)// 每次数据更新都重置滚动this.yPos = 0this.xPos = 0this._stopMove()// 5秒后开始新的滚动setTimeout(() => {if (this.data.length >= this.options.limitMoveNum) {this._initMove()this._startMove()}}, 5000)},autoPlay(bol) {if (bol) {this.reset()} else {this._stopMove()}}},beforeCreate() {this.reqFrame = null // move动画的animationFrame定时器this.isHover = false // mouseenter mouseleave 控制this._move()的开关this.ease = 'ease-in'},beforeDestroy() {this._cancle()}
}
</script>

源文件

<template><div ref="wrap"><div:style="leftSwitch"v-if="navigation":class="leftSwitchClass"@click="leftSwitchClick"><slot name="left-switch"></slot></div><div:style="rightSwitch"v-if="navigation":class="rightSwitchClass"@click="rightSwitchClick"><slot name="right-switch"></slot></div><divref="realBox":style="pos"@mouseenter="enter"@mouseleave="leave"@touchstart="touchStart"@touchmove="touchMove"@touchend="touchEnd"><div ref="slotList" :style="float"><slot></slot></div><div v-html="copyHtml" :style="float"></div></div></div>
</template><script>require('comutils/animationFrame')()const arrayEqual = require('comutils/arrayEqual')const copyObj = require('comutils/copyObj')export default {name: 'vue-seamless-scroll',data () {return {xPos: 0,yPos: 0,delay: 0,copyHtml: '',height: 0,width: 0, // 外容器宽度realBoxWidth: 0, // 内容实际宽度}},props: {data: {type: Array,default: () => {return []}},classOption: {type: Object,default: () => {return {}}}},computed: {leftSwitchState () {return this.xPos < 0},rightSwitchState () {return Math.abs(this.xPos) < (this.realBoxWidth - this.width)},leftSwitchClass () {return this.leftSwitchState ? '' : this.options.switchDisabledClass},rightSwitchClass () {return this.rightSwitchState ? '' : this.options.switchDisabledClass},leftSwitch () {return {position: 'absolute',margin: `${this.height / 2}px 0 0 -${this.options.switchOffset}px`,transform: 'translate(-100%,-50%)'}},rightSwitch () {return {position: 'absolute',margin: `${this.height / 2}px 0 0 ${this.width + this.options.switchOffset}px`,transform: 'translateY(-50%)'}},float () {return this.isHorizontal ? { float: 'left', overflow: 'hidden' } : { overflow: 'hidden' }},pos () {return {transform: `translate(${this.xPos}px,${this.yPos}px)`,transition: `all ${this.ease} ${this.delay}ms`,overflow: 'hidden'}},defaultOption () {return {step: 1, //步长limitMoveNum: 5, //启动无缝滚动最小数据数hoverStop: true, //是否启用鼠标hover控制direction: 1, // 0 往下 1 往上 2向左 3向右openTouch: true, //开启移动端touchsingleHeight: 0, //单条数据高度有值hoverStop关闭singleWidth: 0, //单条数据宽度有值hoverStop关闭waitTime: 1000, //单步停止等待时间switchOffset: 30,autoPlay: true,navigation: false,switchSingleStep: 134,switchDelay: 400,switchDisabledClass: 'disabled',isSingleRemUnit: false // singleWidth/singleHeight 是否开启rem度量}},options () {return copyObj({}, this.defaultOption, this.classOption)},navigation () {return this.options.navigation},autoPlay () {if (this.navigation) return falsereturn this.options.autoPlay},scrollSwitch () {return this.data.length >= this.options.limitMoveNum},hoverStopSwitch () {return this.options.hoverStop && this.autoPlay && this.scrollSwitch},canTouchScroll () {return this.options.openTouch},isHorizontal () {return this.options.direction > 1},baseFontSize () {return this.options.isSingleRemUnit ? parseInt(window.getComputedStyle(document.documentElement, null).fontSize) : 1},realSingleStopWidth () {return this.options.singleWidth * this.baseFontSize},realSingleStopHeight () {return this.options.singleHeight * this.baseFontSize},step () {let singleSteplet step = this.options.stepif (this.isHorizontal) {singleStep = this.realSingleStopWidth} else {singleStep = this.realSingleStopHeight}if (singleStep > 0 && singleStep % step > 0) {console.error('如果设置了单步滚动,step需是单步大小的约数,否则无法保证单步滚动结束的位置是否准确。~~~~~')}return step}},methods: {reset () {this._cancle()this._initMove()},leftSwitchClick () {if (!this.leftSwitchState) return// 小于单步距离if (Math.abs(this.xPos) < this.options.switchSingleStep) {this.xPos = 0return}this.xPos += this.options.switchSingleStep},rightSwitchClick () {if (!this.rightSwitchState) return// 小于单步距离if ((this.realBoxWidth - this.width + this.xPos) < this.options.switchSingleStep) {this.xPos = this.width - this.realBoxWidthreturn}this.xPos -= this.options.switchSingleStep},_cancle () {cancelAnimationFrame(this.reqFrame || '')},touchStart (e) {if (!this.canTouchScroll) returnlet timerconst touch = e.targetTouches[0] //touches数组对象获得屏幕上所有的touch,取第一个touchconst { waitTime, singleHeight, singleWidth } = this.optionsthis.startPos = {x: touch.pageX,y: touch.pageY} //取第一个touch的坐标值this.startPosY = this.yPos //记录touchStart时候的posYthis.startPosX = this.xPos //记录touchStart时候的posXif (!!singleHeight && !!singleWidth) {if (timer) clearTimeout(timer)timer = setTimeout(() => {this._cancle()}, waitTime + 20)} else {this._cancle()}},touchMove (e) {//当屏幕有多个touch或者页面被缩放过,就不执行move操作if (!this.canTouchScroll || e.targetTouches.length > 1 || e.scale && e.scale !== 1) returnconst touch = e.targetTouches[0]const { direction } = this.optionsthis.endPos = {x: touch.pageX - this.startPos.x,y: touch.pageY - this.startPos.y}event.preventDefault(); //阻止触摸事件的默认行为,即阻止滚屏const dir = Math.abs(this.endPos.x) < Math.abs(this.endPos.y) ? 1 : 0 //dir,1表示纵向滑动,0为横向滑动if (dir === 1 && direction < 2) {  // 表示纵向滑动 && 运动方向为上下this.yPos = this.startPosY + this.endPos.y} else if (dir === 0 && direction > 1) { // 为横向滑动 && 运动方向为左右this.xPos = this.startPosX + this.endPos.x}},touchEnd () {if (!this.canTouchScroll) returnlet timerconst direction = this.options.directionthis.delay = 50if (direction === 1) {if (this.yPos > 0) this.yPos = 0} else if (direction === 0) {let h = this.realBoxHeight / 2 * -1if (this.yPos < h) this.yPos = h} else if (direction === 2) {if (this.xPos > 0) this.xPos = 0} else if (direction === 3) {let w = this.realBoxWidth * -1if (this.xPos < w) this.xPos = w}if (timer) clearTimeout(timer)timer = setTimeout(() => {this.delay = 0this._move()}, this.delay)},enter () {if (this.hoverStopSwitch) this._stopMove()},leave () {if (this.hoverStopSwitch) this._startMove()},_move () {// 鼠标移入时拦截_move()if (this.isHover) returnthis._cancle() //进入move立即先清除动画 防止频繁touchMove导致多动画同时进行this.reqFrame = requestAnimationFrame(function () {const h = this.realBoxHeight / 2  //实际高度const w = this.realBoxWidth / 2 //宽度let { direction, waitTime } = this.optionslet { step } = thisif (direction === 1) { // 上if (Math.abs(this.yPos) >= h) {this.$emit('ScrollEnd')this.yPos = 0}this.yPos -= step} else if (direction === 0) { // 下if (this.yPos >= 0) {this.$emit('ScrollEnd')this.yPos = h * -1}this.yPos += step} else if (direction === 2) { // 左if (Math.abs(this.xPos) >= w) {this.$emit('ScrollEnd')this.xPos = 0}this.xPos -= step} else if (direction === 3) { // 右if (this.xPos >= 0) {this.$emit('ScrollEnd')this.xPos = w * -1}this.xPos += step}if (this.singleWaitTime) clearTimeout(this.singleWaitTime)if (!!this.realSingleStopHeight) { //是否启动了单行暂停配置if (Math.abs(this.yPos) % this.realSingleStopHeight < step) { // 符合条件暂停waitTimethis.singleWaitTime = setTimeout(() => {this._move()}, waitTime)} else {this._move()}} else if (!!this.realSingleStopWidth) {if (Math.abs(this.xPos) % this.realSingleStopWidth < step) { // 符合条件暂停waitTimethis.singleWaitTime = setTimeout(() => {this._move()}, waitTime)} else {this._move()}} else {this._move()}}.bind(this))},_initMove () {this.$nextTick(() => {const { switchDelay } = this.optionsconst { autoPlay, isHorizontal } = thisthis._dataWarm(this.data)this.copyHtml = '' //清空copyif (isHorizontal) {this.height = this.$refs.wrap.offsetHeightthis.width = this.$refs.wrap.offsetWidthlet slotListWidth = this.$refs.slotList.offsetWidth// 水平滚动设置warp widthif (autoPlay) {// 修正offsetWidth四舍五入slotListWidth = slotListWidth * 2 + 1}this.$refs.realBox.style.width = slotListWidth + 'px'this.realBoxWidth = slotListWidth}if (autoPlay) {this.ease = 'ease-in'this.delay = 0} else {this.ease = 'linear'this.delay = switchDelayreturn}// 是否可以滚动判断if (this.scrollSwitch) {let timerif (timer) clearTimeout(timer)this.copyHtml = this.$refs.slotList.innerHTMLsetTimeout(() => {this.realBoxHeight = this.$refs.realBox.offsetHeightthis._move()}, 0);} else {this._cancle()this.yPos = this.xPos = 0}})},_dataWarm (data) {if (data.length > 100) {console.warn(`数据达到了${data.length}条有点多哦~,可能会造成部分老旧浏览器卡顿。`);}},_startMove () {this.isHover = false //开启_movethis._move()},_stopMove () {this.isHover = true //关闭_move// 防止频频hover进出单步滚动,导致定时器乱掉if (this.singleWaitTime) clearTimeout(this.singleWaitTime)this._cancle()},},mounted () {this._initMove()},watch: {data (newData, oldData) {this._dataWarm(newData)//监听data是否有变更if (!arrayEqual(newData, oldData)) {this.reset()}},autoPlay (bol) {if (bol) {this.reset()} else {this._stopMove()}}},beforeCreate () {this.reqFrame = null // move动画的animationFrame定时器this.singleWaitTime = null // single 单步滚动的定时器this.isHover = false // mouseenter mouseleave 控制this._move()的开关this.ease = 'ease-in'},beforeDestroy () {this._cancle()clearTimeout(this.singleWaitTime)}}
</script>

相关文章:

vue-seamless-scroll 结束从头开始,加延时后滚动

今天遇到一个大屏需求&#xff1a; 1️⃣初始进入页面停留5秒&#xff0c;然后开始滚动 2️⃣最后一条数据出现在最后一行时候暂停5秒&#xff0c;然后返回1️⃣ 依次循环&#xff0c;发现vue-seamless-scroll的方法 ScrollEnd是监测最后一条数据消失在第一行才回调&#xff…...

不同的数据库操作方式:MongoDB(NoSQL)和 MySQL/SQL

这两种写法分别使用了不同的数据库操作方式&#xff1a;第一种是 MongoDB&#xff08;NoSQL&#xff09; 的写法&#xff0c;第二种是 MySQL/SQL 的写法。我们来对比它们的区别&#xff0c;并给出优化建议。 1. MongoDB&#xff08;NoSQL&#xff09;写法 const user await d…...

0-EATSA-GNN:基于图节点分类师生机制的边缘感知和两阶段注意力增强图神经网络(code)

code:https://github.com/afofanah/EATSA-GNN. 文章目录 Abstract1. Introduction1.1.动态图场景1.2.EATSA-GNN框架的背景化2. Background2.1.GNN边缘感知挑战2.2.GNN的可解释性问题2.3.EATSA-GNN可解释性3. Related worksAbstract 图神经网络(GNNs)从根本上改变了我们处理和…...

大数据学习(124)-spark数据倾斜

&#x1f34b;&#x1f34b;大数据学习&#x1f34b;&#x1f34b; &#x1f525;系列专栏&#xff1a; &#x1f451;哲学语录: 用力所能及&#xff0c;改变世界。 &#x1f496;如果觉得博主的文章还不错的话&#xff0c;请点赞&#x1f44d;收藏⭐️留言&#x1f4dd;支持一…...

配置前端控制器

一、DispatcherServlet 详解 在使用 Spring MVC 框架构建 Web 应用时&#xff0c;DispatcherServlet是整个请求处理流程的核心。本文将深入解析DispatcherServlet的作用、工作原理及其在 Spring MVC 架构中的关键地位。 1.DispatcherServlet 是什么&#xff1f; DispatcherS…...

lua注意事项

感觉是lua的一大坑啊&#xff0c;它还不如函数内部就局部变量呢 注意函数等内部&#xff0c;全部给加上local得了...

Git的三种合并方式

在 Gitee&#xff08;码云&#xff09;中合并分支主要有三种方式&#xff1a;​普通合并&#xff08;Merge Commit&#xff09;、压缩合并&#xff08;Squash Merge&#xff09;​和变基合并&#xff08;Rebase Merge&#xff09;​。每种方式适用于不同的场景&#xff0c;各有…...

从零到一:我的技术博客导航(持续更新)

作者&#xff1a;冰茶 最后更新&#xff1a;2025年6月3日 本文收录了我的C#编程学习心得与技术探索&#xff0c;将持续更新 前言 作为一名.NET开发者&#xff0c;C#语言的学习与探索一直是我技术成长的核心路径。本文集整理了我在C#学习过程中的思考与实践&#xff0c;希望能够…...

SpringBoot整合Flowable【08】- 前后端如何交互

引子 在第02篇中&#xff0c;我通过 Flowable-UI 绘制了一个简单的绩效流程&#xff0c;并在后续章节中基于这个流程演示了 Flowable 的各种API调用。然而&#xff0c;在实际业务场景中&#xff0c;如果要求前端将用户绘制的流程文件发送给后端再进行解析处理&#xff0c;这种…...

DM达梦数据库开启SQL日志记录功能

DM达梦数据库开启SQL日志记录功能 配置SQL日志&#xff08;非必须的配置步骤&#xff0c;与主备集群配置无关&#xff0c;如果没有需求可以跳过配置SQL日志&#xff09; sqllog.ini 配置文件用于SQL日志的配置&#xff0c;当且仅当 INI&#xff08;dm.ini&#xff09; 参数 SV…...

00 QEMU源码分析中文注释与架构讲解(v8.2.4版本)

QEMU-v8.2.4源码中文注释与架构讲解 文档会不定期更新 注释作者将狼才鲸创建日期2025-05-30更新日期2025-06-02 CSDN阅读地址&#xff1a;QEMU源码中文注释与架构讲解Gitee源码仓库地址&#xff1a;才鲸嵌入式/qemu 一、前言 其它参考教程的网址&#xff1a; QEMU 源码目录…...

【五模型时间序列预测对比】Transformer-LSTM、Transformer、CNN-LSTM、LSTM、CNN

【五模型时间序列预测对比】Transformer-LSTM、Transformer、CNN-LSTM、LSTM、CNN 目录 【五模型时间序列预测对比】Transformer-LSTM、Transformer、CNN-LSTM、LSTM、CNN预测效果基本介绍程序设计参考资料 预测效果 基本介绍 Transformer-LSTM、Transformer、CNN-LSTM、LSTM、…...

深入了解MCP基础与架构

一、引言 在人工智能技术以指数级速度渗透各行业领域的今天&#xff0c;我们正站在一个关键的技术拐点。当ChatGPT月活突破亿级、Gemini Pro实现多模态实时交互、Claude 3.5 Sonnet突破百万上下文长度&#xff0c;这些里程碑事件背后&#xff0c;一个崭新的大门逐步打开&#…...

实验设计与分析(第6版,Montgomery)第5章析因设计引导5.7节思考题5.13 R语言解题

本文是实验设计与分析&#xff08;第6版&#xff0c;Montgomery著&#xff0c;傅珏生译) 第5章析因设计引导5.7节思考题5.13 R语言解题。主要涉及方差分析&#xff0c;正态假设检验&#xff0c;残差分析&#xff0c;交互作用图。 dataframe<-data.frame( yc(36,18,30,39,20…...

怎么选择合适的高防IP

选择合适的高防IP需要综合考虑业务需求、防护能力、服务稳定性、成本效益等多方面因素。以下是从多个权威来源整理的关键要点&#xff0c;帮助您做出科学决策&#xff1a; 一、明确业务需求 业务类型与规模 网站/应用类&#xff1a;需支持HTTP/HTTPS协议&#xff0c;并配置域名…...

【java面试】MySQL篇

MySQL篇 一、总体结构二、优化&#xff08;一&#xff09;定位慢查询1.1 开源工具1.2Mysql自带的慢日志查询1.3 总结 &#xff08;二&#xff09;定位后优化2.1 优化2.2 总结 &#xff08;三&#xff09;索引3.1 索引3.2 索引底层数据结构——B树3.3 总结 &#xff08;四&#…...

贪心算法应用:欧拉路径(Fleury算法)详解

Java中的贪心算法应用&#xff1a;欧拉路径&#xff08;Fleury算法&#xff09;详解 一、欧拉路径与欧拉回路基础 1.1 基本概念 欧拉路径&#xff08;Eulerian Path&#xff09;是指在一个图中&#xff0c;经过图中每一条边且每一条边只经过一次的路径。如果这条路径的起点和…...

【算法设计与分析】实验——二维0-1背包问题(算法分析题:算法思路),独立任务最优调度问题(算法实现题:实验过程,描述,小结)

说明&#xff1a;博主是大学生&#xff0c;有一门课是算法设计与分析&#xff0c;这是博主记录课程实验报告的内容&#xff0c;题目是老师给的&#xff0c;其他内容和代码均为原创&#xff0c;可以参考学习&#xff0c;转载和搬运需评论吱声并注明出处哦。 要求&#xff1a;3-…...

P12592题解

题目传送门 思路 由于题目中说了可以任意交换两个字符的位置&#xff0c;我们只需要判断这个字符串是否满足回文串的条件即可。 代码&#xff1a; #include<bits/stdc.h> using namespace std; int a[30]; int main(){int T;cin>>T;while(T--){fill(a,a29,0);/…...

ffmpeg命令(二):分解与复用命令

分解&#xff08;Demuxing&#xff09; 提取视频流&#xff08;不含音频&#xff09; ffmpeg -i input.mp4 -an -vcodec copy video.h264-an&#xff1a;去掉音频 -vcodec copy&#xff1a;拷贝视频码流&#xff0c;不重新编码 提取音频流&#xff08;不含视频&#xff09…...

【Git】View Submitted Updates——diff、show、log

在 Git 中查看更新的内容&#xff08;即工作区、暂存区或提交之间的差异&#xff09;是日常开发中的常见操作。以下是常用的命令和场景说明&#xff1a; 文章目录 1、查看工作区与暂存区的差异2、查看提交历史中的差异3、查看工作区与最新提交的差异4、查看两个提交之间的差异5…...

deepseek原理和项目实战笔记2 -- deepseek核心架构

混合专家&#xff08;MoE&#xff09; ​​混合专家&#xff08;Mixture of Experts, MoE&#xff09;​​ 是一种机器学习模型架构&#xff0c;其核心思想是通过组合多个“专家”子模型&#xff08;通常为小型神经网络&#xff09;来处理不同输入&#xff0c;从而提高模型的容…...

在 MATLAB 2015a 中如何调用 Python

在 MATLAB 2015a 中调用 Python 可通过系统命令调用、.NET 交互层包装、MEX 接口间接桥接、环境变量配置四种方式&#xff0c;但因该版本对 Python 支持有限&#xff0c;主要依赖的是系统命令调用与间接脚本交互。其中&#xff0c;通过 system() 函数调用 Python 脚本是最简单且…...

房屋租赁系统 Java+Vue.js+SpringBoot,包括房屋类型、房屋信息、预约看房、合同信息、房屋报修、房屋评价、房主管理模块

房屋租赁系统 JavaVue.jsSpringBoot&#xff0c;包括房屋类型、房屋信息、预约看房、合同信息、房屋报修、房屋评价、房主管理模块 百度云盘链接&#xff1a;https://pan.baidu.com/s/1KmwOFzN9qogyaLQei3b6qw 密码&#xff1a;l2yn 摘 要 社会的发展和科学技术的进步&#xf…...

华为OD机试真题——生成哈夫曼树(2025B卷:100分)Java/python/JavaScript/C/C++/GO六种最佳实现

2025 B卷 100分 题型 本文涵盖详细的问题分析、解题思路、代码实现、代码详解、测试用例以及综合分析; 并提供Java、python、JavaScript、C++、C语言、GO六种语言的最佳实现方式! 本文收录于专栏:《2025华为OD真题目录+全流程解析/备考攻略/经验分享》 华为OD机试真题《生成…...

react与vue的渲染原理

vue&#xff1a;响应式驱动模板编译 &#xff08;1&#xff09;模板编译 将模板&#xff08;.vue 文件或 HTML 模板&#xff09;编译为 渲染函数&#xff08;Render Function&#xff09;&#xff1b; &#xff08;2&#xff09;响应式依赖收集 初始化时&#xff0c;通过 Ob…...

我提出结构学习的思路,意图用结构学习代替机器学习

我提出结构学习的思路&#xff0c;意图用结构学习代替机器学习 1.机器学习的本质和缺点 机器学习的规律是设计算法、用数据训练算法、让算法学会产生正确的数据回答问题&#xff0c;其缺点在于&#xff0c;需要大规模训练数据和巨大算力还其次&#xff0c;机器学习不能产生智…...

Outbox模式:确保微服务间数据可靠交换的设计方案

https://debezium.io/blog/2019/02/19/reliable-microservices-data-exchange-with-the-outbox-pattern/ Outbox模式是一种在微服务架构中确保数据更改和消息/事件发布之间可靠性的设计模式。它解决了在更新数据库和发送消息这两个独立操作中可能出现的不一致问题&#xff08;…...

数据可视化的定义和类型

数据可视化是一种将数据转换为图形或视觉表示的方法。想象一下&#xff0c;你面前有一堆数字和表格&#xff0c;看着这些&#xff0c;可能会让人头大。数据可视化就像是给这些枯燥的数字画上一幅画。它用图表、地图和各种有趣的图形&#xff0c;帮我们把难懂的数字变得容易看懂…...

sqlite-vec:谁说SQLite不是向量数据库?

sqlite-vec 是一个 SQLite 向量搜索插件&#xff0c;具有以零依赖、轻量级、跨平台和高效 KNN 搜索等优势&#xff0c;是本地化向量检索&#xff08;例如 RAG&#xff09;、轻量级 AI 应用以及边缘计算等场景的理想工具。 sqlite-vec 使用纯 C 语言实现&#xff0c;零外部依赖…...