【Vue】- ref获取DOM元素和购物车案例分析
文章目录
- 知识回顾
- 前言
- 源码分析
- 1. ref
- 2. 购物车案例分析
- 3. 购物车计算、全选
- 拓展知识
- 数据持久化localStorage
- 总结
知识回顾
前言
元素上使用 ref属性关联响应式数据,获取DOM元素
步骤
● 创建 ref => const hRef = ref(null)
● 模板中建立关联 => <h1 ref="hRef">我是标题</h1>=> hRef.value
源码分析
1. ref
const inp = ref<null | HTMLInputElement>()
const img = ref<null | HTMLImageElement>()
vue
<script setup lang="ts">
import { onMounted, ref } from 'vue'const words = ref('')
const inp = ref<null | HTMLInputElement>()
const img = ref<null | HTMLImageElement>()
onMounted(() => {console.log('onMounted')inp.value?.focus()img.valueconsole.log(img.value)console.log(inp.value)
})
</script><template><div class="container" id="app"><div class="search-container"><img ref="img" src="https://" alt="" /><div class="search-box"><input ref="inp" type="text" v-model="words" id="inp" /><button>搜索一下</button></div></div></div>
</template><style>
html,
body {height: 100%;
}.search-container {position: absolute;top: 30%;left: 50%;transform: translate(-50%, -50%);text-align: center;
}.search-container .search-box {display: flex;
}.search-container img {margin-bottom: 30px;
}.search-container .search-box input {width: 512px;height: 16px;padding: 12px 16px;font-size: 16px;margin: 0;vertical-align: top;outline: 0;box-shadow: none;border-radius: 10px 0 0 10px;border: 2px solid #c4c7ce;background: #fff;color: #222;overflow: hidden;box-sizing: content-box;-webkit-tap-highlight-color: transparent;
}.search-container .search-box button {cursor: pointer;width: 112px;height: 44px;line-height: 41px;line-height: 42px;background-color: #ad2a27;border-radius: 0 10px 10px 0;font-size: 17px;box-shadow: none;font-weight: 400;border: 0;outline: 0;letter-spacing: normal;color: white;
}body {background: no-repeat center / cover;background-color: #edf0f5;
}
</style>
2. 购物车案例分析
列表渲染、购物车增加删除
css
.app-container {padding-bottom: 300px;width: 800px;margin: 0 auto;
}
@media screen and (max-width: 800px) {.app-container {width: 600px;}
}
.app-container .banner-box {border-radius: 20px;overflow: hidden;margin-bottom: 10px;
}
.app-container .banner-box img {width: 100%;
}
.app-container .nav-box {background: #ddedec;height: 60px;border-radius: 10px;padding-left: 20px;display: flex;align-items: center;
}
.app-container .nav-box .my-nav {display: inline-block;background: #5fca71;border-radius: 5px;width: 90px;height: 35px;color: white;text-align: center;line-height: 35px;margin-right: 10px;
}.breadcrumb {font-size: 16px;color: gray;
}
.table {width: 100%;text-align: left;border-radius: 2px 2px 0 0;border-collapse: separate;border-spacing: 0;
}
.th {color: rgba(0, 0, 0, 0.85);font-weight: 500;text-align: left;background: #fafafa;border-bottom: 1px solid #f0f0f0;transition: background 0.3s ease;
}
.th.num-th {flex: 1.5;
}
.th {text-align: center;
}
.th:nth-child(4),
.th:nth-child(5),
.th:nth-child(6),
.th:nth-child(7) {text-align: center;
}
.th.th-pic {flex: 1.3;
}
.th:nth-child(6) {flex: 1.3;
}.th,
.td {position: relative;padding: 16px 16px;overflow-wrap: break-word;flex: 1;
}
.pick-td {font-size: 14px;
}
.main,
.empty {border: 1px solid #f0f0f0;margin-top: 10px;
}
.tr {display: flex;cursor: pointer;border-bottom: 1px solid #ebeef5;
}
.tr.active {background-color: #f5f7fa;
}
.td {display: flex;justify-content: center;align-items: center;
}.table img {width: 100px;height: 100px;
}button {outline: 0;box-shadow: none;color: #fff;background: #d9363e;border-color: #d9363e;color: #fff;background: #d9363e;border-color: #d9363e;line-height: 1.5715;position: relative;display: inline-block;font-weight: 400;white-space: nowrap;text-align: center;background-image: none;border: 1px solid transparent;box-shadow: 0 2px 0 rgb(0 0 0 / 2%);cursor: pointer;transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;touch-action: manipulation;height: 32px;padding: 4px 15px;font-size: 14px;border-radius: 2px;
}
button.pay {background-color: #3f85ed;margin-left: 20px;
}.bottom {height: 60px;display: flex;align-items: center;justify-content: space-between;padding-right: 20px;border: 1px solid #f0f0f0;border-top: none;padding-left: 20px;
}
.right-box {display: flex;align-items: center;
}
.check-all {cursor: pointer;
}
.price {color: hotpink;font-size: 30px;font-weight: 700;
}
.price-box {display: flex;align-items: center;
}
.empty {padding: 20px;text-align: center;font-size: 30px;color: #909399;
}
.my-input-number {display: flex;
}
.my-input-number button {height: 40px;color: #333;border: 1px solid #dcdfe6;background-color: #f5f7fa;
}
.my-input-number button:disabled {cursor: not-allowed!important;
}
.my-input-number .my-input__inner {height: 40px;width: 50px;padding: 0;border: none;border-top: 1px solid #dcdfe6;border-bottom: 1px solid #dcdfe6;
}
vue
<script setup lang="ts">
import { ref } from 'vue'// 定义水果对象的类型
interface Fruit {id: numbericon: stringisChecked: booleannum: numberprice: number
}// 水果列表
const fruitList = ref<Fruit[]>([{id: 1,icon: 'https://hongm-1312445828.cos.ap-nanjing.myqcloud.com/ll.png',isChecked: true,num: 2,price: 6},{id: 2,icon: 'https://hongm-1312445828.cos.ap-nanjing.myqcloud.com/smt.png',isChecked: false,num: 7,price: 20},{id: 3,icon: 'https://hongm-1312445828.cos.ap-nanjing.myqcloud.com/tg.png',isChecked: false,num: 3,price: 40},{id: 4,icon: 'https://hongm-1312445828.cos.ap-nanjing.myqcloud.com/xg.png',isChecked: false,num: 10,price: 3},{id: 5,icon: 'https://hongm-1312445828.cos.ap-nanjing.myqcloud.com/yl.png',isChecked: false,num: 20,price: 34}
])// 删除商品
const delGoods = (id: number) => {fruitList.value = fruitList.value.filter((item) => item.id !== id)
}
// 添加
const addGoods = (id: number) => {const fruit = fruitList.value.find((item) => item.id === id)fruit && fruit.num++
}
// 减少
const subGoods = (id: number) => {const fruit = fruitList.value.find((item) => item.id === id)fruit && fruit.num--
}
</script><template><div class="app-container" id="app"><!-- 顶部banner --><div class="banner-box"><img src="https://hongm-1312445828.cos.ap-nanjing.myqcloud.com/sg_top.png" alt="" /></div><!-- 面包屑 --><div class="breadcrumb"><span>🏠</span>/<span>购物车</span></div><!-- 购物车主体 --><div v-if="fruitList.length > 0" class="main"><div class="table"><!-- 头部 --><div class="thead"><div class="tr"><div class="th">选中</div><div class="th th-pic">图片</div><div class="th">单价</div><div class="th num-th">个数</div><div class="th">小计</div><div class="th">操作</div></div></div><!-- 身体 --><div class="tbody"><divv-for="item in fruitList":key="item.id"class="tr":class="{ active: item.isChecked }"><div class="td"><input type="checkbox" v-model="item.isChecked" /></div><div class="td"><img :src="item.icon" alt="" /></div><div class="td">{{ item.price }}</div><div class="td"><div class="my-input-number"><button :disabled="item.num <= 1" class="decrease" @click="subGoods(item.id)">-</button><span class="my-input__inner">{{ item.num }}</span><button class="increase" @click="addGoods(item.id)">+</button></div></div><div class="td">{{ item.price * item.num }}</div><div class="td" @click="delGoods(item.id)"><button>删除</button></div></div></div></div><!-- 底部 --><div class="bottom"><!-- 全选 --><label class="check-all"><input type="checkbox" />全选</label><div class="right-box"><!-- 所有商品总价 --><span class="price-box">总价 : ¥ <span class="price">24</span></span><!-- 结算按钮 --><button class="pay">结算( 6 )</button></div></div></div><!-- 空车 --><div v-else class="empty">🛒空空如也</div></div>
</template><style scoped>
@import './style/inputnumber.css';
@import './style/index.css';
</style>
3. 购物车计算、全选
<script setup lang="ts">
import { computed, ref } from 'vue'// 定义水果对象的类型
interface Fruit {id: numbericon: stringisChecked: booleannum: numberprice: number
}// 水果列表
const fruitList = ref<Fruit[]>([{id: 1,icon: 'https://hongm-1312445828.cos.ap-nanjing.myqcloud.com/ll.png',isChecked: true,num: 2,price: 6},{id: 2,icon: 'https://hongm-1312445828.cos.ap-nanjing.myqcloud.com/smt.png',isChecked: false,num: 7,price: 20},{id: 3,icon: 'https://hongm-1312445828.cos.ap-nanjing.myqcloud.com/tg.png',isChecked: false,num: 3,price: 40},{id: 4,icon: 'https://hongm-1312445828.cos.ap-nanjing.myqcloud.com/xg.png',isChecked: false,num: 10,price: 3},{id: 5,icon: 'https://hongm-1312445828.cos.ap-nanjing.myqcloud.com/yl.png',isChecked: false,num: 20,price: 34}
])// 删除商品
const delGoods = (id: number) => {fruitList.value = fruitList.value.filter((item) => item.id !== id)
}
// 添加
const addGoods = (id: number) => {const fruit = fruitList.value.find((item) => item.id === id)fruit && fruit.num++
}
// 减少
const subGoods = (id: number) => {const fruit = fruitList.value.find((item) => item.id === id)fruit && fruit.num--
}// 全选
const checkAll = computed({get() {return fruitList.value.every((item) => item.isChecked)},set(value) {fruitList.value.forEach((item) => (item.isChecked = value))}
})// 统计选中的总数 reduce
const totalCount = computed(() => {return fruitList.value.reduce((sum, item) => {if (item.isChecked) {// 选中 → 需要累加return sum + item.num} else {// 没选中 → 不需要累加return sum}}, 0)
})// 总计选中的总价 num * price
const totalPrice = computed(() => {return fruitList.value.reduce((sum, item) => {if (item.isChecked) {return sum + item.num * item.price} else {return sum}}, 0)
})
</script><template><div class="app-container" id="app"><!-- 顶部banner --><div class="banner-box"><img src="https://hongm-1312445828.cos.ap-nanjing.myqcloud.com/sg_top.png" alt="" /></div><!-- 面包屑 --><div class="breadcrumb"><span>🏠</span>/<span>购物车</span></div><!-- 购物车主体 --><div v-if="fruitList.length > 0" class="main"><div class="table"><!-- 头部 --><div class="thead"><div class="tr"><div class="th">选中</div><div class="th th-pic">图片</div><div class="th">单价</div><div class="th num-th">个数</div><div class="th">小计</div><div class="th">操作</div></div></div><!-- 身体 --><div class="tbody"><divv-for="item in fruitList":key="item.id"class="tr":class="{ active: item.isChecked }"><div class="td"><input type="checkbox" v-model="item.isChecked" /></div><div class="td"><img :src="item.icon" alt="" /></div><div class="td">{{ item.price }}</div><div class="td"><div class="my-input-number"><button :disabled="item.num <= 1" class="decrease" @click="subGoods(item.id)">-</button><span class="my-input__inner">{{ item.num }}</span><button class="increase" @click="addGoods(item.id)">+</button></div></div><div class="td">{{ item.price * item.num }}</div><div class="td" @click="delGoods(item.id)"><button>删除</button></div></div></div></div><!-- 底部 --><div class="bottom"><!-- 全选 --><label class="check-all"><input type="checkbox" v-model="checkAll" />全选</label><div class="right-box"><!-- 所有商品总价 --><span class="price-box">总价 : ¥ <span class="price">{{ totalPrice }}</span></span><!-- 结算按钮 --><button class="pay">结算( {{ totalCount }} )</button></div></div></div><!-- 空车 --><div v-else class="empty">🛒空空如也</div></div>
</template><style scoped>
@import './style/inputnumber.css';
@import './style/index.css';
</style>
拓展知识
数据持久化localStorage
<script setup lang="ts">
import { computed, ref, watch } from 'vue'// 定义水果对象的类型
interface Fruit {id: numbericon: stringisChecked: booleannum: numberprice: number
}
const defaultData = [{id: 1,icon: 'https://hongm-1312445828.cos.ap-nanjing.myqcloud.com/ll.png',isChecked: true,num: 2,price: 6},{id: 2,icon: 'https://hongm-1312445828.cos.ap-nanjing.myqcloud.com/smt.png',isChecked: false,num: 7,price: 20},{id: 3,icon: 'https://hongm-1312445828.cos.ap-nanjing.myqcloud.com/tg.png',isChecked: false,num: 3,price: 40},{id: 4,icon: 'https://hongm-1312445828.cos.ap-nanjing.myqcloud.com/xg.png',isChecked: false,num: 10,price: 3},{id: 5,icon: 'https://hongm-1312445828.cos.ap-nanjing.myqcloud.com/yl.png',isChecked: false,num: 20,price: 34}
]// 水果列表
let fruitList = ref<Fruit[]>(defaultData)
const localStorageFruitList = localStorage.getItem('fruitList')
if (localStorageFruitList && localStorageFruitList !== '[]') {fruitList.value = JSON.parse(localStorageFruitList)
}// 删除商品
const delGoods = (id: number) => {fruitList.value = fruitList.value.filter((item) => item.id !== id)
}
// 添加
const addGoods = (id: number) => {const fruit = fruitList.value.find((item) => item.id === id)fruit && fruit.num++
}
// 减少
const subGoods = (id: number) => {const fruit = fruitList.value.find((item) => item.id === id)fruit && fruit.num--
}// 全选
const checkAll = computed({get() {return fruitList.value.every((item) => item.isChecked)},set(value) {fruitList.value.forEach((item) => (item.isChecked = value))}
})// 统计选中的总数 reduce
const totalCount = computed(() => {return fruitList.value.reduce((sum, item) => {if (item.isChecked) {// 选中 → 需要累加return sum + item.num} else {// 没选中 → 不需要累加return sum}}, 0)
})// 总计选中的总价 num * price
const totalPrice = computed(() => {return fruitList.value.reduce((sum, item) => {if (item.isChecked) {return sum + item.num * item.price} else {return sum}}, 0)
})// 数据持久化方法
const saveData = () => {localStorage.setItem('fruitList', JSON.stringify(fruitList.value))
}
const getData = () => {const fruitListStr = localStorage.getItem('fruitList')
}
// 删除持久化
const delData = () => {localStorage.removeItem('fruitList')
}
// 清空持久化数据
const clearData = () => {localStorage.clear()
}
// 监听
watch(() => fruitList.value, saveData, { deep: true, immediate: true })
</script><template><div class="app-container" id="app"><!-- 顶部banner --><div class="banner-box"><img src="https://hongm-1312445828.cos.ap-nanjing.myqcloud.com/sg_top.png" alt="" /></div><!-- 面包屑 --><div class="breadcrumb"><span>🏠</span>/<span>购物车</span></div><!-- 购物车主体 --><div v-if="fruitList.length > 0" class="main"><div class="table"><!-- 头部 --><div class="thead"><div class="tr"><div class="th">选中</div><div class="th th-pic">图片</div><div class="th">单价</div><div class="th num-th">个数</div><div class="th">小计</div><div class="th">操作</div></div></div><!-- 身体 --><div class="tbody"><divv-for="item in fruitList":key="item.id"class="tr":class="{ active: item.isChecked }"><div class="td"><input type="checkbox" v-model="item.isChecked" /></div><div class="td"><img :src="item.icon" alt="" /></div><div class="td">{{ item.price }}</div><div class="td"><div class="my-input-number"><button :disabled="item.num <= 1" class="decrease" @click="subGoods(item.id)">-</button><span class="my-input__inner">{{ item.num }}</span><button class="increase" @click="addGoods(item.id)">+</button></div></div><div class="td">{{ item.price * item.num }}</div><div class="td" @click="delGoods(item.id)"><button>删除</button></div></div></div></div><!-- 底部 --><div class="bottom"><!-- 全选 --><label class="check-all"><input type="checkbox" v-model="checkAll" />全选</label><div class="right-box"><!-- 所有商品总价 --><span class="price-box">总价 : ¥ <span class="price">{{ totalPrice }}</span></span><!-- 结算按钮 --><button class="pay">结算( {{ totalCount }} )</button></div></div></div><!-- 空车 --><div v-else class="empty">🛒空空如也</div></div>
</template><style scoped>
@import './style/inputnumber.css';
@import './style/index.css';
</style>
总结
相关文章:
【Vue】- ref获取DOM元素和购物车案例分析
文章目录 知识回顾前言源码分析1. ref2. 购物车案例分析3. 购物车计算、全选 拓展知识数据持久化localStorage 总结 知识回顾 前言 元素上使用 ref属性关联响应式数据,获取DOM元素 步骤 ● 创建 ref > const hRef ref(null) ● 模板中建立关联 > <h1 re…...

【AI大模型】ChatGPT模型原理介绍(下)
目录 🍔 GPT-3介绍 1.1 GPT-3模型架构 1.2 GPT-3训练核心思想 1.3 GPT-3数据集 1.4 GPT-3模型的特点 1.5 GPT-3模型总结 🍔 ChatGPT介绍 2.1 ChatGPT原理 2.2 什么是强化学习 2.3 ChatGPT强化学习步骤 2.4 监督调优模型 2.5 训练奖励模型 2.…...
Python数据分析与可视化实战指南
在数据驱动的时代,Python因其简洁的语法、强大的库生态系统以及活跃的社区,成为了数据分析与可视化的首选语言。本文将通过一个详细的案例,带领大家学习如何使用Python进行数据分析,并通过可视化来直观呈现分析结果。 一、环境准…...

react18基础教程系列-- 框架基础理论知识mvc/jsx/createRoot
react的设计模式 React 是 mvc 体系,vue 是 mvvm 体系 mvc: model(数据)-view(视图)-controller(控制器) 我们需要按照专业的语法去构建 app 页面,react 使用的是 jsx 语法构建数据层,需要动态处理的的数据都要数据层支持控制层: 当我们需要…...
牛客周赛 Round 60 折返跑(组合数学)
题目链接:题目 大意: 在 1 1 1到 n n n之间往返跑m趟,推 m − 1 m-1 m−1次杆子,每次都向中间推,不能推零次,问有多少种推法(mod 1e97)。 思路: 一个高中学过的组合数…...
深入浅出Java匿名内部类:用法详解与实例演示
匿名内部类(Anonymous Inner Class)在Java中是一种非常有用的特性,它允许你在一个类的定义中直接创建并实例化一个内部类,而不需要为这个内部类指定一个名字。匿名内部类通常用于以下几种情况: 实现接口:当…...
数据库MySQL、Mariadb、PostgreSQL、MangoDB、Memcached和Redis详细介绍
以下是一些常见的后端开发数据库选型: 关系型数据库(RDBMS):关系型数据库是最常见的数据库类型,使用表格和关系模型来存储和管理数据。常见的关系型数据库包括MySQL、PostgreSQL和Oracle等。这些数据库适合处理结构化数…...

【ArcGIS Pro实操第七期】栅格数据合并、裁剪及统计:以全球不透水面积为例
【ArcGIS Pro实操第七期】批量裁剪:以全球不透水面积为例 准备:数据下载ArcGIS Pro批量裁剪数据集1 数据拼接2 数据裁剪3 数据统计:各栅格取值3.1 栅格计算器-精确提取-栅格数据特定值3.2 数据统计 4 不透水面积变化分析 参考 准备࿱…...
【Linux】Image、zImage与uImage的区别
1、Image 1.1 什么是 Image Image 是一种未压缩的 Linux 内核镜像文件,包含了内核的所有代码、数据和必要的元信息。它是 Linux 内核在编译过程中生成的一个原始的二进制文件,未经过任何压缩或额外的封装处理。由于未压缩,Image 文件相对较…...
算子加速(3):自定义cuda扩展
需要自定义某个层,或有时候用c++实现你的操作(c++扩展)可能会更好: 例如:需要实现一个新型的激活函数例如: bevfusion用cuda实现bevpool加速自定义扩展的步骤 (1) 首先用纯pytorch和python 实现我们所需的功能,看看效果再决定要不要进一步优化(2) 明确优化方向,用C++ (或CU…...

信息安全数学基础(14)欧拉函数
前言 在信息安全数学基础中,欧拉函数(Eulers Totient Function)是一个非常重要的概念,它与模运算、剩余类、简化剩余系以及密码学中的许多应用紧密相关。欧拉函数用符号 φ(n) 表示,其中 n 是一个正整数。 一、定义 欧…...

7-17 汉诺塔的非递归实现
输入样例: 3输出样例: a -> c a -> b c -> b a -> c b -> a b -> c a -> c 分析: 不会汉罗塔的uu们,先看看图解: 非递归代码: #include<iostream> #include<stack> using namespace std; s…...

word文档无损原样转pdf在windows平台使用python调用win32com使用pip安装pywin32
前提: windows环境下,并且安装了office套装,比如word,如果需要调用excel.也需要安装。在另外的文章会介绍。这种是直接调用word的。所以还原度会比较高。 需求: word文档转pdf,要求使用命令行形式,最终发布为api接口…...

海康威视相机在QTcreate上的使用教程
文章目录 前言:基础夯实:效果展示:图片展示:视频展示: 参考的资料:遇到问题:问题1:int64 does not问题2:LNK2019配置思路(这个很重要)配置关键图片:配置具体过…...

进程状态、进程创建和进程分类
文章目录 进程进程常见的状态进程调度进程状态变化关系 进程标识示例--进程标识的使用以及简介 进程创建fork函数vfork函数示例--使用fork函数创建子进程,并了解进程之间的关系 创建进程时发生的变化虚拟内存空间的变化示例--验证fork函数创建进程时的操作 对文件IO…...
java后端请求调用三方接口
java后端请求调用三方接口 /*** param serverURL http接口地址(例:http://www.iwsu.top:8016/dataSyn/bay/statsCar)* param parm 参数(可以是json,也可以是json数组)*/ public void doRestfulPostBody(St…...
C#使用TCP-S7协议读写西门子PLC(三)
接上篇 C#使用TCP-S7协议读写西门子PLC(二)-CSDN博客 这里我们进行封装读写西门子PLC的S7协议命令以及连接西门子PLC并两次握手 新建部分类文件SiemensS7ProtocolUtil.ReadWrite.cs 主要方法: 连接西门子PLC并发送两次握手。两次握手成功后,才真正连…...

铝型材及其常用紧固件、连接件介绍
铝型材介绍(包括紧固件和连接件以及走线) 铝型材 铝型材一般是6063铝合金挤压成型,分为欧标和国标两个标准。(左边国标,右边欧标,欧标槽宽一点) 由于槽型不一样,相关的螺栓和螺母也…...
【裸机装机系列】7.kali(ubuntu)-安装开发所需工具
如果你是后端或是人工智能AI岗,可以安装以下推荐的软件: 1> sublime sublime官网 下载deb文件 安装命令 sudo dpkg -i sublime-text_build-4143_amd64.deb2> vscode 安装前置软件 sudo apt install curl gpg software-properties-common apt-t…...

[C语言]第九节 函数一基础知识到高级技巧的全景探索
目录 9.1 函数的概念 9.2 库函数 9.2.1 标准库与库函数 示例:常见库函数 9.2.2 标准库与头文件的关系 参考资料和学习工具 如何使用库函数 编辑 9.3 ⾃定义函数 9.3.1 函数的语法形式 9.3.2函数的举例 9.4 实参与形参 9.4.1 什么是实参? 9…...

Framework开发之IMS逻辑浅析1--关键线程及作用
关键线程:EventHub,InputReader,InputDispatcher EventHub: 由于Android继承Linux,Linux的思想是一切皆文件,而输入的类型不止一种(触碰,写字笔,键盘等),每种类型都对应一种驱动设备,而每个硬件驱动设备又对应Linux的一个目录文件…...

ESP12E/F 参数对比
模式GPIO0GPIO2GPIO15描述正常启动高高低从闪存运行固件闪光模式低高低启用固件刷写 PinNameFunction1RSTReset (Active Low)2ADC (A0)Analog Input (0–1V)3EN (CH_PD)Chip Enable (Pull High for Normal Operation)4GPIO16Wake from Deep Sleep, General Purpose I/O5GPIO14S…...
DeepSeek 终章:破局之路,未来已来
目录 一、DeepSeek 技术发展现状回顾二、未来发展趋势2.1 多模态融合的拓展2.2 模型可解释性的强化2.3 垂直领域的深化应用 三、面临的技术挑战3.1 数据隐私与安全难题3.2 算法偏见与公平性困境3.3 网络攻击与恶意利用威胁 四、挑战应对策略探讨4.1 技术层面的解决方案4.2 算法…...

AI时代:学习永不嫌晚,语言多元共存
最近看到两个关于AI的两个问题,“现在开始学习AI,是不是为时已晚?”、“AI出现以后,翻译几乎已到末路,那么,随着时代的进步,中文会一统全球吗?” 联想到自己正在做的“万能AI盒”小程…...

AlphaDrive:通过强化学习和推理释放自动驾驶中 VLM 的力量
AlphaDrive: Unleashing the Power of VLMs in Autonomous Driving via Reinforcement Learning and Reasoning 25年3月来自华中科技大学和地平线的论文 OpenAI 的 o1 和 DeepSeek R1 在数学和科学等复杂领域达到甚至超越了人类专家水平,其中强化学习(R…...

CAN通信收发测试(USB2CAN模块测试实验)
1.搭建测试环境 电脑:安装 USB 驱动,安装原厂调试工具,安装cangaroo(参考安装包的入门教程即可) USB驱动路径:~\CAN分析仪资料20230701_Linux\硬件驱动程序 原厂调试工具路径:~\CAN分析仪资料2…...
Android第十三次面试总结基础
Activity生命周期和四大启动模式详解 一、Activity 生命周期 Activity 的生命周期由一系列回调方法组成,用于管理其创建、可见性、焦点和销毁过程。以下是核心方法及其调用时机: onCreate() 调用时机:Activity 首次创建时调用。…...
2. 库的操作
2.1 创建数据库 语法: CREATE DATABASE [IF NOT EXISTS] db_name [create_specification [, create_specification] ...] create_specification: [DEFAULT] CHARACTER SET charset_name # 字符集: 存储编码 [DEFAULT] COLLATE collation_name # 校验集: 比较/选择/读…...
Flask音频处理:构建高效的Web音频应用指南
引言 在当今多媒体丰富的互联网环境中,音频处理功能已成为许多Web应用的重要组成部分。无论是音乐分享平台、语音识别服务还是播客应用,都需要强大的音频处理能力。Python的Flask框架因其轻量级和灵活性,成为构建这类应用的理想选择。 本文…...
前端开发三剑客:HTML5+CSS3+ES6
在前端开发领域,HTML、CSS和JavaScript构成了构建网页与Web应用的核心基础。随着技术标准的不断演进,HTML5、CSS3以及ES6(ECMAScript 2015及后续版本)带来了诸多新特性与语法优化,极大地提升了开发效率和用户体验。本文…...