14 vue3之内置组件trastion全系列

前置知识

 Vue 提供了 transition 的封装组件,在下列情形中,可以给任何元素和组件添加进入/离开过渡:

  • 条件渲染 (使用 v-if)
  • 条件展示 (使用 v-show)
  • 动态组件
  • 组件根节点

自定义 transition 过度效果,你需要对transition组件的name属性自定义。并在css中写入对应的样式

web 动画库-CSDN博客文章浏览阅读2次。动画领域有一个比较知名的CSS库:Animate.css,它提供了60多种动画,满足一般网页的需求,比如淡入淡出、闪现等等一系列日常动画,不过虽然它能满足日常需求,但是一些复杂的场景就需要靠JS手动去操作,比如界面滚动到某个元素才开始播放动画,比如拖拽、比如滚动界面时,动态调整元素就需要使用到GreenSockhttps://blog.csdn.net/qq_37550440/article/details/142390818?sharetype=blogdetail&sharerId=142390818&sharerefer=PC&sharesource=qq_37550440&spm=1011.2480.3001.8118

 安装依赖包

npm i @types/lodash lodash

npm i animate.css

npm i gsap

1.过渡的类名 name

在进入/离开的过渡中,会有 6 个 class 切换。

v-enter-from:定义进入过渡的开始状态。在元素被插入之前生效,在元素被插入之后的下一帧移除。

v-enter-active:定义进入过渡生效时的状态。在整个进入过渡的阶段中应用,在元素被插入之前生效,在过渡/动画完成之后移除。这个类可以被用来定义进入过渡的过程时间,延迟和曲线函数。

v-enter-to:定义进入过渡的结束状态。在元素被插入之后下一帧生效 (与此同时 v-enter-from 被移除),在过渡/动画完成之后移除。

v-leave-from:定义离开过渡的开始状态。在离开过渡被触发时立刻生效,下一帧被移除。

v-leave-active:定义离开过渡生效时的状态。在整个离开过渡的阶段中应用,在离开过渡被触发时立刻生效,在过渡/动画完成之后移除。这个类可以被用来定义离开过渡的过程时间,延迟和曲线函数。

v-leave-to:离开过渡的结束状态。在离开过渡被触发之后下一帧生效 (与此同时 v-leave-from 被移除),在过渡/动画完成之后移除。

<template><h2>transition name基础用法</h2><button @click="flag0 = !flag0">切换0</button><transition:duration="{ enter: 500, leave: 800 }"name="fade0"><div class="box" v-if="flag0"></div></transition>
</template><script setup lang="ts">
import { ref, reactive, watch } from "vue";
let flag0 = ref(false);
</script><style lang="less" scoped>
.box {width: 200px;height: 200px;background-color: pink;
}
// 切换0
//进入之前
.fade0-enter-from {width: 0px;height: 0px;
}
//进入过程
.fade0-enter-active {transition: all 2s ease;
}
// 最后一帧
.fade0-enter-to {//进入完成最好和box保持一致width: 200px;height: 200px;background: red;
}
.fade0-leave-from {//离开之前width: 200px;height: 200px;
}
.fade0-leave-active {//离开过程transition: all 3s linear;
}
.fade0-leave-to {//离开的最后一帧width: 0px;height: 0px;
}</style>

2.自定义过渡 class 类名

trasnsition props

  • enter-from-class
  • enter-active-class
  • enter-to-class
  • leave-from-class
  • leave-active-class
  • leave-to-class
<template><button @click="flag = !flag">切换1</button><h2>transition 自定义过渡 class 类名每个都对应一个类名,与name的区别是能结合第三方的内库使用</h2><transitionname="fade"enter-from-class="e-from"enter-active-class="e-active"enter-to-class="e-to"><div class="box" v-if="flag"></div></transition>
</template><script setup lang="ts">
import { ref, reactive, watch } from "vue";
let flag = ref(false);
</script><style lang="less" scoped>
// 切换1样式
.fade-enter-from, //进入之前
.e-from {width: 0px;height: 0px;
}
.fade-enter-active, //进入过度
.e-active {transition: all 2.5s ease;transform: rotate(360);
}.fade-enter-to, // 进入完成
.e-to {width: 200px;height: 200px;
}
.fade-leave-from {// 离开之前width: 200px;height: 200px;
}
.fade-leave-active {//离开过度transition: all 2.5s ease;transform: rotate(360);
}.fade-leave-to {// 离开完成width: 20px;height: 20px;
}
</style>

3 自定义class结合animate.css案例

<template>
<h2>transition 结合animate使用, 更丝滑</h2><button @click="flag2 = !flag2">animate切换2</button><transition:duration="{ enter: 500, leave: 800 }"leave-active-class="animate__animated animate__bounceInLeft"enter-active-class="animate__animated animate__bounceInRight"><div class="box" v-if="flag2"></div></transition>
</template><script setup lang="ts">
import "animate.css";
import gsap from "gsap";
import _ from "lodash"; // 报错的话就需要安装ts的声明文件 Npm I @type/lodash -D
import { ref, reactive, watch } from "vue";
let flag2 = ref(false);
</script><style lang="less" scoped></style>

4.transition 生命周期8个

<template>
<h2>transition 的8个生命周期函数</h2><button @click="flag3 = !flag3">切换3</button><transition@before-enter="beforeEnter"@enter="enterActive"@after-enter="enterTo"@enter-cancelled="enterCancelled"@before-leave="beforeLeave"@leave="leaveActive"@after-leave="leaveTo"@leave-cancelled="leaveCancelled"><div class="box" v-if="flag3"></div></transition></template><script setup lang="ts">
import "animate.css";
import gsap from "gsap";
import _ from "lodash"; // 报错的话就需要安装ts的声明文件 Npm I @type/lodash -D
import { ref, reactive, watch } from "vue";
let flag0 = ref(false);let beforeEnter = (el: Element) => {//对应enter-fromconsole.log("进入之前", el);
};
let enterActive = (el: Element, done: Function) => {//对应enter-activeconsole.log("过度曲线");setTimeout(() => {done();}, 3000);
};
let enterTo = (el: Element) => {//对应enter-toconsole.log("进入完成");
};
let enterCancelled = () => {//多点击几次console.log("过度效果被打断");//显示过程被打断
};
let beforeLeave = () => {//对应leave-fromconsole.log("离开之前");
};
let leaveActive = (el: Element, done: Function) => {//对应enter-activemconsole.log("离开过度曲线");setTimeout(() => {done();}, 3000);
};
let leaveTo = () => {//对应leave-toconsole.log("离开完成");
};
let leaveCancelled = () => {//离开过度打断
};
</script><style lang="less" scoped></style>

5 transition生命周期与gsap结合使用案例

<template>
<h2>transition生命周期钩子函数 与gsap 结合案例 npm i gsap最健全的web动画库之一, 更丝滑</h2><button @click="flag4 = !flag4">gsap切换4</button><transition@before-enter="beforeEnter1"@enter="enter1"@leave="leave1"><div class="box" v-if="flag4"></div></transition></template><script setup lang="ts">
import "animate.css";
import gsap from "gsap";
import _ from "lodash"; // 报错的话就需要安装ts的声明文件 Npm I @type/lodash -D
import { ref, reactive, watch } from "vue";
let flag4 = ref(false);
let beforeEnter1 = (el: Element) => {gsap.set(el, {width: 0,height: 0,});
};
let enter1 = (el: Element, done: gsap.Callback) => {gsap.to(el, {width: 200,height: 200,onComplete: done,});
};
let leave1 = (el: Element, done: gsap.Callback) => {gsap.to(el, {width: 0,height: 0,onComplete: done,});
};
</script><style lang="less" scoped></style>

6 appear自动加载的动画可用于大屏使用

<template>
<h2>transition 之appear首次页面加载完成后的动画 案例</h2><transitionappearappear-from-class="appear-from"appear-active-class="appear-active"appear-to-class="appear-to"><div class="box"></div></transition><hr /></template><script setup lang="ts">
import "animate.css";
import gsap from "gsap";
import _ from "lodash"; // 报错的话就需要安装ts的声明文件 Npm I @type/lodash -D
import { ref, reactive, watch } from "vue";</script><style lang="less" scoped>
.appear-from {width: 0;height: 0;
}
.appear-active {transition: all 2.5s ease;
}
.appear-to {width: 200px;height: 200px;
}
</style>

7 transition 之appear与结合animate使用 案例

<template><h2>transition 之appear与结合animate使用 案例</h2><transitionappearappear-active-class="animate__animated animate__bounceInRight"><div class="box"></div></transition>
</template><script setup lang="ts">
import "animate.css";
import gsap from "gsap";
import _ from "lodash"; // 报错的话就需要安装ts的声明文件 Npm I @type/lodash -D
import { ref, reactive, watch } from "vue";
let flag0 = ref(false);
</script><style lang="less" scoped></style>

transition-group

8 transition-group过度列表

单个节点
多个节点,每次只渲染一个
那么怎么同时渲染整个列表,比如使用 v-for?在这种场景下,我们会使用 <transition-group> 组件。在我们深入例子之前,先了解关于这个组件的几个特点:

默认情况下,它不会渲染一个包裹元素,但是你可以通过 tag attribute 指定渲染一个元素。
过渡模式不可用,因为我们不再相互切换特有的元素。
内部元素总是需要提供唯一的 key attribute 值。
CSS 过渡的类将会应用在内部的元素中,而不是这个组/容器本身。

<template><h2>transition group使用</h2><button @click="add">add</button><button @click="pop">pop</button><div class="group_wraps"><transition-groupenter-active-class="animate__animated animate__bounceInRight"leave-active-class="animate__animated animate__bounceInLeft"><div v-for="(item, index) in list" :key="index">{{ item }}</div></transition-group></div>
</template><script setup lang="ts">
import "animate.css";
import gsap from "gsap";
import _ from "lodash"; // 报错的话就需要安装ts的声明文件 Npm I @type/lodash -D
import { ref, reactive, watch } from "vue";
let flag0 = ref(false);
let list = reactive<number[]>([1, 2, 3, 4]);
let add = () => {list.push(list.length + 1);
};
let pop = () => {list.pop();
};
</script><style lang="less" scoped></style>

9 列表的(平移)移动过渡  move-class

<transition-group> 组件还有一个特殊之处。除了进入和离开,它还可以为定位的改变添加动画。只需了解新增的 v-move 类就可以使用这个新功能,它会应用在元素改变定位的过程中。像之前的类名一样,它的前缀可以通过 name attribute 来自定义,也可以通过 move-class attribute 手动设置

<template><h2>transition group(底层是aerotwist FLIP这个动画库实现的)列表过渡动画案例 平移过度move-class npm i @types/lodashlodash</h2><button @click="random">random</button><transition-grouptag="div"class="wraps"move-class="group_move"enter-active-class="animate__animated animate__bounceInRight"leave-active-class="animate__animated animate__bounceInLeft"><div class="item" v-for="item in data" :key="item.id">{{ item.number }}</div></transition-group>
</template><script setup lang="ts">
import "animate.css";
import gsap from "gsap";
import _ from "lodash"; // 报错的话就需要安装ts的声明文件 Npm I @type/lodash -D
import { ref, reactive, watch } from "vue";
//区别 new Array(81)得到的是[空属性(Empty attribute) × 81] 与 Array.apply(null,[1,2,3]) 第一个参数是this指向,第二个参数是数组
// ts检测到第二个参数不是数组我们要假装他是一个数组用as number[]
/*
list = ['a','b']
list.map((item,index)=>{ // 第一个参数是item,第二个是indexconsole.log(item) a ,bconsole.log(index) 0 ,1
})1%1 = 0
1%9 = 1
1%10 = 1*/
let data = ref(Array.apply(null, {length: 81,} as number[]).map((_, index) => {return {id: index, // 作为keynumber: (index % 9) + 1, // 从1开始  1-9*1-9的组合};})
);let random = () => {data.value = _.shuffle(data.value);
};let num = reactive({currentNum: 0,gsapNum: 0,
});watch(() => num.currentNum,(newVal) => {gsap.to(num, {duration: 1,gsapNum: newVal,});}
);
</script><style lang="less" scoped>
.wraps {display: flex;flex-wrap: wrap;width: calc(20px * 10 + 10px); // 整个父级的宽度,合理换行.item {width: 20px;height: 20px;border: 1px solid #ccc;list-style-type: none;display: flex;justify-content: center;align-items: center;}
}
.group_move {transition: all 0.8s ease;
}
</style>

10 状态过度 借助gsap库案例

<template><h2>状态过度 借助gsap库</h2><h3>Vue 也同样可以给数字 Svg 背景颜色等添加过度动画今天演示数字变化</h3><input v-model="num.currentNum" type="number" step="20" /><div>{{ num.gsapNum.toFixed(0) }}</div>
</template><script setup lang="ts">
import "animate.css";
import gsap from "gsap";
import _ from "lodash"; // 报错的话就需要安装ts的声明文件 Npm I @type/lodash -D
import { ref, reactive, watch } from "vue";let num = reactive({currentNum: 0,gsapNum: 0,
});watch(() => num.currentNum,(newVal) => {gsap.to(num, {duration: 1,gsapNum: newVal,});}
);
</script><style lang="less" scoped>
.wraps {display: flex;flex-wrap: wrap;width: calc(20px * 10 + 10px); // 整个父级的宽度,合理换行.item {width: 20px;height: 20px;border: 1px solid #ccc;list-style-type: none;display: flex;justify-content: center;align-items: center;}
}
.group_move {transition: all 0.8s ease;
}
</style>

完整实例代码

<template><h2>transition name基础用法</h2><button @click="flag0 = !flag0">切换0</button><transition:duration="{ enter: 500, leave: 800 }"name="fade0"><div class="box" v-if="flag0"></div></transition><hr /><button @click="flag = !flag">切换1</button><h2>transition 自定义过渡 class 类名每个都对应一个类名,与name的区别是能结合第三方的内库使用</h2><transitionname="fade"enter-from-class="e-from"enter-active-class="e-active"enter-to-class="e-to"><div class="box" v-if="flag"></div></transition><hr /><!--transition 结合animat使用  npm i animate.css  --><h2>transition 结合animate使用, 更丝滑</h2><button @click="flag2 = !flag2">animate切换2</button><transition:duration="{ enter: 500, leave: 800 }"leave-active-class="animate__animated animate__bounceInLeft"enter-active-class="animate__animated animate__bounceInRight"><div class="box" v-if="flag2"></div></transition><hr /><h2>transition 的8个生命周期函数</h2><button @click="flag3 = !flag3">切换3</button><transition@before-enter="beforeEnter"@enter="enterActive"@after-enter="enterTo"@enter-cancelled="enterCancelled"@before-leave="beforeLeave"@leave="leaveActive"@after-leave="leaveTo"@leave-cancelled="leaveCancelled"><div class="box" v-if="flag3"></div></transition><hr /><h2>transition生命周期钩子函数 与gsap 结合案例 npm i gsap最健全的web动画库之一, 更丝滑</h2><button @click="flag4 = !flag4">gsap切换4</button><transition@before-enter="beforeEnter1"@enter="enter1"@leave="leave1"><div class="box" v-if="flag4"></div></transition><hr /><h2>transition 之appear首次页面加载完成后的动画 案例</h2><transitionappearappear-from-class="appear-from"appear-active-class="appear-active"appear-to-class="appear-to"><div class="box"></div></transition><hr /><h2>transition 之appear与结合animate使用 案例</h2><transitionappearappear-active-class="animate__animated animate__bounceInRight"><div class="box"></div></transition><hr /><h2>transition group使用</h2><button @click="add">add</button><button @click="pop">pop</button><div class="group_wraps"><transition-groupenter-active-class="animate__animated animate__bounceInRight"leave-active-class="animate__animated animate__bounceInLeft"><div v-for="(item, index) in list" :key="index">{{ item }}</div></transition-group></div><hr /><h2>transition group(底层是aerotwist FLIP这个动画库实现的)列表过渡动画案例 平移过度move-class npm i @types/lodashlodash</h2><button @click="random">random</button><transition-grouptag="div"class="wraps"move-class="group_move"enter-active-class="animate__animated animate__bounceInRight"leave-active-class="animate__animated animate__bounceInLeft"><div class="item" v-for="item in data" :key="item.id">{{ item.number }}</div></transition-group><hr /><h2>状态过度 借助gsap库</h2><h3>Vue 也同样可以给数字 Svg 背景颜色等添加过度动画今天演示数字变化</h3><input v-model="num.currentNum" type="number" step="20" /><div>{{ num.gsapNum.toFixed(0) }}</div>
</template><script setup lang="ts">
import "animate.css";
import gsap from "gsap";
import _ from "lodash"; // 报错的话就需要安装ts的声明文件 Npm I @type/lodash -D
import { ref, reactive, watch } from "vue";let flag0 = ref(false);
let flag = ref(false);
let flag2 = ref(false);
let flag3 = ref(false);
let flag4 = ref(false);
let list = reactive<number[]>([1, 2, 3, 4]);//区别 new Array(81)得到的是[空属性(Empty attribute) × 81] 与 Array.apply(null,[1,2,3]) 第一个参数是this指向,第二个参数是数组
// ts检测到第二个参数不是数组我们要假装他是一个数组用as number[]
/*
list = ['a','b']
list.map((item,index)=>{ // 第一个参数是item,第二个是indexconsole.log(item) a ,bconsole.log(index) 0 ,1
})1%1 = 0
1%9 = 1
1%10 = 1*/
let data = ref(Array.apply(null, {length: 81,} as number[]).map((_, index) => {return {id: index, // 作为keynumber: (index % 9) + 1, // 从1开始  1-9*1-9的组合};})
);let random = () => {data.value = _.shuffle(data.value);
};let num = reactive({currentNum: 0,gsapNum: 0,
});watch(() => num.currentNum,(newVal) => {gsap.to(num, {duration: 1,gsapNum: newVal,});}
);let beforeEnter = (el: Element) => {//对应enter-fromconsole.log("进入之前", el);
};
let enterActive = (el: Element, done: Function) => {//对应enter-activeconsole.log("过度曲线");setTimeout(() => {done();}, 3000);
};
let enterTo = (el: Element) => {//对应enter-toconsole.log("进入完成");
};
let enterCancelled = () => {//多点击几次console.log("过度效果被打断");//显示过程被打断
};
let beforeLeave = () => {//对应leave-fromconsole.log("离开之前");
};
let leaveActive = (el: Element, done: Function) => {//对应enter-activemconsole.log("离开过度曲线");setTimeout(() => {done();}, 3000);
};
let leaveTo = () => {//对应leave-toconsole.log("离开完成");
};
let leaveCancelled = () => {//离开过度打断
};let beforeEnter1 = (el: Element) => {gsap.set(el, {width: 0,height: 0,});
};
let enter1 = (el: Element, done: gsap.Callback) => {gsap.to(el, {width: 200,height: 200,onComplete: done,});
};
let leave1 = (el: Element, done: gsap.Callback) => {gsap.to(el, {width: 0,height: 0,onComplete: done,});
};let add = () => {list.push(list.length + 1);
};
let pop = () => {list.pop();
};
</script><style lang="less" scoped>
.box {width: 200px;height: 200px;background-color: pink;
}
// 切换0
//进入之前
.fade0-enter-from {width: 0px;height: 0px;
}
//进入过程
.fade0-enter-active {transition: all 2s ease;
}
// 最后一帧
.fade0-enter-to {//进入完成最好和box保持一致width: 200px;height: 200px;background: red;
}
.fade0-leave-from {//离开之前width: 200px;height: 200px;
}
.fade0-leave-active {//离开过程transition: all 3s linear;
}
.fade0-leave-to {//离开的最后一帧width: 0px;height: 0px;
}
// 切换1样式
.fade-enter-from, //进入之前
.e-from {width: 0px;height: 0px;
}
.fade-enter-active, //进入过度
.e-active {transition: all 2.5s ease;transform: rotate(360);
}.fade-enter-to, // 进入完成
.e-to {width: 200px;height: 200px;
}
.fade-leave-from {// 离开之前width: 200px;height: 200px;
}
.fade-leave-active {//离开过度transition: all 2.5s ease;transform: rotate(360);
}.fade-leave-to {// 离开完成width: 20px;height: 20px;
}.appear-from {width: 0;height: 0;
}
.appear-active {transition: all 2.5s ease;
}
.appear-to {width: 200px;height: 200px;
}.wraps {display: flex;flex-wrap: wrap;width: calc(20px * 10 + 10px); // 整个父级的宽度,合理换行.item {width: 20px;height: 20px;border: 1px solid #ccc;list-style-type: none;display: flex;justify-content: center;align-items: center;}
}
.group_move {transition: all 0.8s ease;
}
</style>

15 跨组件通信依赖注入provide和inject-CSDN博客Provide / Inject通常,当我们需要从父组件向子组件传递数据时,我们使用 props。想象一下这样的结构:有一些深度嵌套的组件,而深层的子组件只需要父组件的部分内容。在这种情况下,如果仍然将 prop 沿着组件链逐级传递下去,可能会很麻烦。https://blog.csdn.net/qq_37550440/article/details/142491343?sharetype=blogdetail&sharerId=142491343&sharerefer=PC&sharesource=qq_37550440&spm=1011.2480.3001.8118

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/54640.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

jupyter安装与使用——Ubuntu服务器

jupyter安装与使用——Ubuntu服务器 一、安装miniconda3/anaconda31. 下载miniconda32. 安装miniconda33. 切换到bin文件夹4. 输入pwd获取路径5. 打开用户环境编辑页面6. 重新加载用户环境变量7. 初始化conda8.验证是否安装成功9.conda配置 二、安装jupyter2.1 conda安装2.2 配…

国货之光|暴雨携信创新品亮相第八届丝博会

9月20日&#xff0c;第八届丝绸之路国际博览会暨中国东西部合作与投资贸易洽谈会&#xff08;以下简称“丝博会”&#xff09;在西安举行。 本届丝博会以“深化互联互通拓展经贸合作”为主题&#xff0c;会期为9月20日至24日&#xff0c;在西安国际会展中心设置国际交流展、省际…

研一奖学金计划2024/9/23有感

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 前言一、需要认真上课的1.应用数理统计&#xff08;开卷考试&#xff09;2.最优化方法&#xff08;开卷考试&#xff09;3.跨文化交际&#xff08;主题演讲20课堂讨…

[系统设计总结] - Proximity Service算法介绍

问题描述 Proximity Service广泛应用于各种地图相关的服务中比如外卖&#xff0c;大众点评&#xff0c;Uber打车&#xff0c;Google地图中&#xff0c;其中比较关键的是我们根据用户的位置来快速找到附近的餐厅&#xff0c;司机&#xff0c;外卖员也就是就近查询算法。 主流的…

小程序面板开发教程|开发照明 Matter 面板步骤(一)

一. 前置知识 前言 出于对 Matter 标准协议及第三方设备接入的可拓展性等方面考虑&#xff0c;照明 Matter 模型面板的功能点定义会与照明的 DP 模型有所不同&#xff0c;因此本文会着重介绍照明 Matter 面板的功能点定义及与 DP 模型的区别&#xff0c;以方便面板小程序开发…

Qt-QLabel 添加图片并设置 GIF 图动态效果

Qt-QLabel 添加图片并设置 GIF 图动态效果 一、添加图片资源并设置图片 选择标签&#xff0c;拖拉到界面上&#xff0c;然后选择器属性 picmap   选择设置&#xff0c;在这里添加图片资源   点击左边的加号符号按钮添加前缀&#xff0c;并设置前缀名&#xff0c;如果已经…

uniapp+renderJS+google map开发安卓版APP非小程序

背景需求 需要在uniapp中接入google地图,研究了一番,都没有找到合适的,现在说一下教程。 效果图 前期工作 这两点缺一不可,否则你啥也看不到。 1、电脑安装L-O-U梯 用于访问G-OO-G-LE的API或者创建google map key。 2、手机安装L-O-U梯 用于显示google地图。我就是手…

数据篇| 关于Selenium反爬杂谈

友情提示:本章节只做相关技术讨论, 爬虫触犯法律责任与作者无关。 LLM虽然如火如荼进行着, 但是没有数据支撑, 都是纸上谈兵, 人工智能的三辆马车:算法-数据-算力,缺一不可。之前写过关于LLM微调文章《微调入门篇:大模型微调的理论学习》、《微调实操一: 增量预训练(Pretrai…

USB 电缆中的信号线 DP、DM 的缩写由来

经常在一些芯片的规格书中看到 USB 的信号对是以 DP 和 DM 命名&#xff1a; 我在想&#xff0c;这些规格书是不是写错了&#xff0c;把 N 写成 M 了&#xff1f;DM 中的 M 到底是什么的缩写&#xff1f; 于是我找了一些资料&#xff0c;终于在《Universal Serial Bus Cables …

xilinx hbm ip运用

AXI-HBM是一个集成的IP核&#xff0c;该核提供高达16个AXI3从PORT的HBM接口&#xff0c;每个使用他自己的独立的时钟。HBM2 GEN存储器也支持&#xff0c;HBM相对传统DDR的方案&#xff0c;带宽得到极大的提高 特征 AXI3从端口存储器接口 -16个独立的256bit存储器接口 -可选的…

Why Is Prompt Tuning for Vision-Language Models Robust to Noisy Labels?

文章汇总 本文的作者针对了提示学习的结构设计进行了分析&#xff0c;发现了一些规律&#xff1a; 1)固定的类名令牌为模型的优化提供了强正则化&#xff0c;减少了由噪声样本引起的梯度。 2)从多样化和通用的web数据中学习到的强大的预训练图像文本嵌入为图像分类提供了强大…

FreeRTOS学习——接口宏portmacro.h

FreeRTOS学习——接口宏portmacro.h&#xff0c;仅用于记录自己阅读与学习源码 FreeRTOS Kernel V10.5.1 portmacro版本&#xff1a;GCC/ARM_CM7 portmacro.h是什么 portmacro.h头文件&#xff0c;用于定义与特定硬件平台相关的数据类型和常量。 在移植过程中&#xff0c;…

stm32 keil有一些别人的工程在你这打开为什么会乱码?如何解决的

因为别人编辑代码使用的编辑器和你的不一样&#xff0c;要更正可以调一下自己的翻译器编码格式 也可以直接换掉文件的格式&#xff0c; 用记事本打开文件&#xff0c;然后点会另存为&#xff0c;下面有个编码格式选择&#xff0c;换成你自己的就行

结构设计模式 -装饰器设计模式 - JAVA

装饰器设计模式 一. 介绍二. 代码示例2.1 抽象构件&#xff08;Component&#xff09;角色2.2 具体构件&#xff08;Concrete Component&#xff09;角色2.3 装饰&#xff08;Decorator&#xff09;角色2.4 具体装饰&#xff08;Concrete Decorator&#xff09;角色2.5 测试 结…

【鸿蒙HarmonyOS NEXT】用户首选项Preference存储数据

【鸿蒙HarmonyOS NEXT】数据存储之用户首选项Preference 一、环境说明二、Preference运作机制三、示例代码加以说明四、小结 一、环境说明 DevEco Studio 版本&#xff1a; API版本&#xff1a;以12为主 二、Preference运作机制 应用场景&#xff1a; 用户首选项为应用提…

模型Alignment之RLHF与DPO

1. RLHF (Reinforcement Learning from Human Feedback) RLHF 是一种通过人类反馈来强化学习的训练方法&#xff0c;它能够让语言模型更好地理解和执行人类指令。 RLHF 的三个阶段 RLHF 的训练过程一般分为三个阶段&#xff1a; 监督微调&#xff08;Supervised Fine-Tuning,…

TensorRT-LLM——优化大型语言模型推理以实现最大性能的综合指南

引言 随着对大型语言模型 (LLM) 的需求不断增长&#xff0c;确保快速、高效和可扩展的推理变得比以往任何时候都更加重要。NVIDIA 的 TensorRT-LLM 通过提供一套专为 LLM 推理设计的强大工具和优化&#xff0c;TensorRT-LLM 可以应对这一挑战。TensorRT-LLM 提供了一系列令人印…

.net core8 使用JWT鉴权(附当前源码)

说明 该文章是属于OverallAuth2.0系列文章&#xff0c;每周更新一篇该系列文章&#xff08;从0到1完成系统开发&#xff09;。 该系统文章&#xff0c;我会尽量说的非常详细&#xff0c;做到不管新手、老手都能看懂。 说明&#xff1a;OverallAuth2.0 是一个简单、易懂、功能强…

YOLOv8——测量高速公路上汽车的速度

引言 在人工神经网络和计算机视觉领域&#xff0c;目标识别和跟踪是非常重要的技术&#xff0c;它们可以应用于无数的项目中&#xff0c;其中许多可能不是很明显&#xff0c;比如使用这些算法来测量距离或对象的速度。 测量汽车速度基本步骤如下&#xff1a; 视频采集&#x…

游戏如何应对云手机刷量问题

云手机的实现原理是依托公有云和 ARM 虚拟化技术&#xff0c;为用户在云端提供一个安卓实例&#xff0c;用户可以将手机上的应用上传至云端&#xff0c;再通过视频流的方式&#xff0c;远程实时控制云手机。 市面上常见的几款云手机 原本需要手机提供的计算、存储等能力都改由…