鸿蒙next 自定义日历组件

效果图预览

20250124-113957

使用说明

1.选择日期左右箭头,实现每月日历切换,示例中超出当前月份,禁止进入下一月,可在代码更改

2.日历中显示当前选择的日期,选中的日期颜色可自定义

3.日历中可展示历史记录作为数据存储标志

4.当前页面选择的日期可在本页面保存状态

可根据自己需求,对日历组件进行更改,将代码拷贝到DevEco Studio 可直接运行使用

日历组件使用代码

@Entry
@Component
struct TEST {@State currentSelectDate: string = calendarUtils.getCurrentDay(); // 当前读取数据日期,用户数据获取private historyDateArray: string[] =[calendarUtils.getPreviousDay(calendarUtils.getCurrentDay()), calendarUtils.getCurrentDay()];private calendarController: CustomDialogController | null = new CustomDialogController({builder: CustomCalendar({currentSelectDate: this.currentSelectDate,defaultSelectDates: this.historyDateArray,colors: ["#fed2cf", "#ed553c", "#f74d33", "#fcfaff"],cancel: () => {this.calendarController?.close();},confirm: (date: Date) => {this.selectCalendarConfirm(date)}}),autoCancel: true,alignment: DialogAlignment.BottomEnd,offset: { dx: -8, dy: -20 },gridCount: 4,showInSubWindow: true,width: 359,isModal: true,customStyle: false,cornerRadius: 16,})// 选择日历确认框selectCalendarConfirm(date: Date) {let dateTime = new Date(date);let year = dateTime.getFullYear();let month = dateTime.getMonth() + 1;let day = dateTime.getDate();let strDate = `${year}-${month}-${day}`;this.currentSelectDate = strDate;let selectIndex = calendarUtils.getDaysFromDate(strDate);this.calendarController?.close();}build() {Column() {Button("日历组件").onClick(() => {this.calendarController?.open();})}.width('100%').height('100%')}
}

日历组件代码

import { calendarUtils } from "../../utlis/calendarUtils";interface monthType {defaultData: boolean,value: number
}// 日历
@CustomDialog
export struct CustomCalendar {controller?: CustomDialogController@State selectedDate: Date = new Date();@State isDateSelected: boolean = false;@State currentMonth: number = new Date().getMonth(); // 当前选择的月数@State defaultMonth: number = new Date().getMonth(); // 默认月数@State currentYear: number = new Date().getFullYear();@Prop defaultSelectDates: string[] = []; // 默认历史数据@State defaultYear: number = new Date().getFullYear();@Prop currentSelectDate: string = calendarUtils.getCurrentDay();@Prop colors: string[] = ["#fed2cf", "#ed553c", "#f74d33", "#fcfaff"]; // 0 默认背景 1 背景默认字体颜色 2 选中背景 3 选中字体颜色@State monthDays: monthType[] = []; // 月份天数cancel: () => void = () => {}confirm: (date: Date) => void = () => {}aboutToAppear() {console.log("currentSelectDate===>", this.currentSelectDate)this.onDefaultDataSelect(this.currentSelectDate);let days = this.getDaysInMonth();console.log("days===>", JSON.stringify(days))this.monthDays = [...days]}build() {Column() {Row({ space: 30 }) {Image($r('app.media.rightArrow')).width('24vp').height('24vp').padding({left: 8,right: 8,top: 4,bottom: 4}).rotate({x: 0,y: 0,z: 90,centerX: '50%',centerY: '50%',angle: 180}).onClick(() => this.onMonthChange(-1))Text(`${this.currentYear}年${this.currentMonth + 1 >= 10 ? this.currentMonth + 1 :'0' + (this.currentMonth + 1)}月`).fontSize(20).fontWeight(FontWeight.Bold).margin({ left: 15, right: 15 })if (this.defaultYear != this.currentYear || this.currentMonth != this.defaultMonth) {Image($r('app.media.rightArrow')).width('24vp').height('24vp').padding({left: 8,right: 8,top: 4,bottom: 4}).onClick(() => this.onMonthChange(1))} else {Image($r('app.media.rightArrowGray')).width('24vp').height('24vp').padding({left: 8,right: 8,top: 4,bottom: 4})}}.width('100%').justifyContent(FlexAlign.Center).margin({ top: 20, bottom: 30 })// 星期标题Row() {ForEach(['日', '一', '二', '三', '四', '五', '六'], (day: string) => {Text(day).textAlign(TextAlign.Center).fontSize(18).fontColor('#999999')}, (day: string) => day)}.width('93%').margin({ bottom: 10 }).justifyContent(FlexAlign.SpaceBetween)Grid() {ForEach(this.monthDays, (item: monthType, index: number) => {GridItem() {Column() {Text(item.value.toString()).fontSize(18).fontWeight(this.isSelectedDate(item.value) ? FontWeight.Bold : FontWeight.Normal).fontColor(this.isSelectedDate(item.value) ? this.colors[3] :item.defaultData ? this.colors[1] : this.getDateColor(item.value))}.width('100%').height('100%').borderRadius(25).backgroundColor(this.isSelectedDate(item.value) ? this.colors[2] :(item.defaultData ? this.colors[0] : Color.Transparent)).justifyContent(FlexAlign.Center)}.aspectRatio(1).onClick(() => this.onDateSelected(item.value))})}.width('100%').columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr').rowsGap(8).columnsGap(8).height('260vp')// 按钮Row() {Button('取消', { type: ButtonType.Normal }).width('140vp').height('50vp').backgroundColor("#f6f6f6").fontColor("#171d29").borderRadius(12).onClick(() => {this.cancel();})Button('确定', { type: ButtonType.Normal }).width('140vp').height('50vp').backgroundColor("#171d29").borderRadius(12).onClick(() => {console.log("this.selectedDate==>", this.selectedDate);this.confirm(this.selectedDate)console.log("this.monthDays=>", JSON.stringify(this.monthDays))})}.width('100%').height('50vp').justifyContent(FlexAlign.SpaceBetween).padding({ left: 18, right: 18 }).margin({ bottom: 10 });}.width('100%').padding({left: 16,right: 16,top: 16,bottom: 16}).backgroundColor('#ffffff')}private onMonthChange(increment: number) {let newMonth = this.currentMonth + incrementlet newYear = this.currentYearif (newMonth > 11) {newMonth = 0newYear++} else if (newMonth < 0) {newMonth = 11newYear--}this.currentMonth = newMonth;this.currentYear = newYear;let result = this.getDaysInMonth();this.monthDays = [...result];}private onDateSelected(day: number) {const newSelectedDate = new Date(this.currentYear, this.currentMonth, day);const currentDate = new Date(this.currentYear, this.currentMonth, day)const today = new Date()// 如果点击的值大于今天值,不选中if (currentDate > today) {return}if (this.isDateSelected &&this.selectedDate.getDate() === day &&this.selectedDate.getMonth() === this.currentMonth &&this.selectedDate.getFullYear() === this.currentYear) {// 如果点击的是已选中的日期,取消选中// this.isDateSelected = falsethis.isDateSelected = true} else {// 否则,选中新的日期this.selectedDate = newSelectedDatethis.isDateSelected = true}}// 默认选中private onDefaultDataSelect(value: string) {let date = value.split("-");let year = Number(date[0]); // 获取当前年let month = Number(date[1]) - 1; // 获取当前月,如果需要渲染到页面,需要+1,不渲染默认进行计算let day = Number(date[2]); // 获取当前天数this.selectedDate = new Date(year, month, day);this.isDateSelected = true;}private isSelectedDate(day: number): boolean {return this.isDateSelected &&this.selectedDate.getDate() === day &&this.selectedDate.getMonth() === this.currentMonth &&this.selectedDate.getFullYear() === this.currentYear}private getDaysInMonth(): monthType[] {const daysInMonth = new Date(this.currentYear, this.currentMonth + 1, 0).getDate();const selectMonth = new Date(this.currentYear, this.currentMonth + 1, 0).getMonth() + 1;const selectYear = new Date(this.currentYear, this.currentMonth + 1, 0).getFullYear();let array = Array.from<number, number>({ length: daysInMonth }, (_, i) => i + 1);let result: monthType[] = [];for (let i = 0; i < array.length; i++) {let obj: monthType = {value: array[i],defaultData: false,}let selectData = this.defaultSelectDates.find((item: string) => {let date = item.split("-");let year = date[0];let month = date[1];let day = date[2];if (selectYear == Number(year) && selectMonth == Number(month) && Number(day) == array[i]) {return item} else {return undefined}});if (selectData) {obj.defaultData = true;} else {obj.defaultData = false;}result.push(obj);}return result;}private getDateColor(day: number): string {const currentDate = new Date(this.currentYear, this.currentMonth, day)const today = new Date()today.setHours(0, 0, 0, 0)if (currentDate > today) {return '#CCCCCC' // 灰色显示过去的日期} else if (this.isSelectedDate(day)) {return '#ffffff' // 选中日期的文字颜色} else {return '#000000' // 未选中日期的文字颜色}}private getLunarDate(day: number): string {return LunarDate.solarToLunar(this.currentYear, this.currentMonth + 1, day);}
}class LunarDate {private static lunarInfo: number[] = [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2,0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977,0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970,0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950,0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557,0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5d0, 0x14573, 0x052d0, 0x0a9a8, 0x0e950, 0x06aa0,0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0,0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b5a0, 0x195a6,0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570,0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x055c0, 0x0ab60, 0x096d5, 0x092e0,0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5,0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930,0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530,0x05aa0, 0x076a3, 0x096d0, 0x04bd7, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45,0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0];private static Gan = ["甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"];private static Zhi = ["子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"];private static Animals = ["鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"];private static lunarMonths = ["正", "二", "三", "四", "五", "六", "七", "八", "九", "十", "冬", "腊"];private static lunarDays = ["初一", "初二", "初三", "初四", "初五", "初六", "初七", "初八", "初九", "初十","十一", "十二", "十三", "十四", "十五", "十六", "十七", "十八", "十九", "二十","廿一", "廿二", "廿三", "廿四", "廿五", "廿六", "廿七", "廿八", "廿九", "三十"];static solarToLunar(year: number, month: number, day: number): string {if (year < 1900 || year > 2100) {return "无效年份";}const baseDate = new Date(1900, 0, 31);const objDate = new Date(year, month - 1, day);let offset = Math.floor((objDate.getTime() - baseDate.getTime()) / 86400000);let i: number, leap = 0, temp = 0;for (i = 1900; i < 2101 && offset > 0; i++) {temp = LunarDate.getLunarYearDays(i);offset -= temp;}if (offset < 0) {offset += temp;i--;}const lunarYear = i;leap = LunarDate.getLeapMonth(i);let isLeap = false;for (i = 1; i < 13 && offset > 0; i++) {if (leap > 0 && i === (leap + 1) && isLeap === false) {--i;isLeap = true;temp = LunarDate.getLeapDays(lunarYear);} else {temp = LunarDate.getLunarMonthDays(lunarYear, i);}if (isLeap === true && i === (leap + 1)) {isLeap = false;}offset -= temp;}if (offset === 0 && leap > 0 && i === leap + 1) {if (isLeap) {isLeap = false;} else {isLeap = true;--i;}}if (offset < 0) {offset += temp;--i;}const lunarMonth = i;const lunarDay = offset + 1;const monthStr = (isLeap ? "闰" : "") + LunarDate.lunarMonths[lunarMonth - 1];const dayStr = LunarDate.lunarDays[lunarDay - 1];return dayStr === '初一' ? monthStr + "月" : dayStr;}private static getLunarYearDays(year: number): number {let i = 0, sum = 348;for (i = 0x8000; i > 0x8; i >>= 1) {sum += (LunarDate.lunarInfo[year - 1900] & i) ? 1 : 0;}return sum + LunarDate.getLeapDays(year);}private static getLeapMonth(year: number): number {return LunarDate.lunarInfo[year - 1900] & 0xf;}private static getLeapDays(year: number): number {if (LunarDate.getLeapMonth(year)) {return (LunarDate.lunarInfo[year - 1900] & 0x10000) ? 30 : 29;}return 0;}private static getLunarMonthDays(year: number, month: number): number {return (LunarDate.lunarInfo[year - 1900] & (0x10000 >> month)) ? 30 : 29;}
}

日期处理utils代码

class CalendarUtils {private totalDays: number = 0;// 获取日历全部时间列表值public getCalendarListCount() {let list: number[] = []for (let i = 1; i <= this.getDaysInLastTenYears(); i++) {list.push(i);}return list;}// 获取前10年的总共天数public getDaysInLastTenYears(): number {const now = new Date();const tenYearsAgo = new Date(now.getFullYear() - 10, now.getMonth(), now.getDate());const millisecondsInDay = 1000 * 60 * 60 * 24;const diffInMilliseconds = now.getTime() - tenYearsAgo.getTime();this.totalDays = Math.ceil(diffInMilliseconds / millisecondsInDay);return Math.ceil(diffInMilliseconds / millisecondsInDay);}// 根据当前天数获取年月日public getDateFromDaysAgo(days: number): string {const now = new Date();let dayCount = this.totalDays - days;const millisecondsPerDay = 1000 * 60 * 60 * 24;const targetDate = new Date(now.getTime() - dayCount * millisecondsPerDay);const year = targetDate.getFullYear();const month = String(targetDate.getMonth() + 1).padStart(2, '0'); // Months are zero-basedconst day = String(targetDate.getDate()).padStart(2, '0');return `${year}-${month}-${day}`;}// 根据年月日获取天数下标 反值public getDaysFromDate(dateString: string): number {const dateParts = dateString.split('-');const targetDate = new Date(Number(dateParts[0]), Number(dateParts[1]) - 1, Number(dateParts[2]));const now = new Date();const diffInMilliseconds = now.getTime() - targetDate.getTime();const millisecondsPerDay = 1000 * 60 * 60 * 24;let days = Math.floor(Math.abs(diffInMilliseconds) / millisecondsPerDay);return (this.totalDays - 1) - days;}// 获取上一天年月日public getPreviousDay(value: string | Date): string {const now = new Date(value);now.setDate(now.getDate() - 1); // 获取前一天const year = now.getFullYear();const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以需要+1,并补0const day = String(now.getDate()).padStart(2, '0'); // 补0return `${year}-${month}-${day}`;}// 获取下一天年月日public getNextDay(value: string | Date): string {const now = new Date(value);now.setDate(now.getDate() + 1); // 获取后一天const year = now.getFullYear();const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以需要+1,并补0const day = String(now.getDate()).padStart(2, '0'); // 补0return `${year}-${month}-${day}`;}// 获取当前年月日public getCurrentDay() {const now = new Date();const year = now.getFullYear();const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份从0开始,加一,补0const day = String(now.getDate()).padStart(2, '0'); // 补0return `${year}-${month}-${day}`;}// 获取前10年的年月茹public getTheFirstYearsDate(value: number) {const currentDate = new Date();const currentYear = currentDate.getFullYear();// 获取前10年的日期const previousTenYearsDate = new Date(currentDate.setFullYear(currentYear - value));const Year = previousTenYearsDate.getFullYear();const Month = String(previousTenYearsDate.getMonth() + 1).padStart(2, '0');const Day = String(previousTenYearsDate.getDate()).padStart(2, '0');return `${Year}-${Month}-${Day}`;}
}// 获取数据预加载
export class MyDataSource implements IDataSource {private list: number[] = []constructor(list: number[]) {this.list = list}totalCount(): number {return this.list.length}getData(index: number): number {return this.list[index]}registerDataChangeListener(listener: DataChangeListener): void {}unregisterDataChangeListener() {}
}export const calendarUtils = new CalendarUtils();

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

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

相关文章

An OpenGL Toolbox

3.An OpenGL Toolbox 声明&#xff1a;该代码来自&#xff1a;Computer Graphics Through OpenGL From Theory to Experiments&#xff0c;仅用作学习参考 3.1 Vertex Arrays and Their Drawing Commands 顶点数组及其绘制命令&#xff1a;将几何数据存储在一个位置&#xff0c…

Three城市引擎地图插件Geo-3d

一、简介 基于Three开发&#xff0c;为Three 3D场景提供GIS能力和城市底座渲染能力。支持Web墨卡托、WGS84、GCJ02等坐标系&#xff0c;支持坐标转换&#xff0c;支持影像、地形、geojson建筑、道路&#xff0c;植被等渲染。支持自定义主题。 二、效果 三、代码 //插件初始化…

侧边导航(Semi Design)

根据前几次的导航栏设计&#xff0c;从最简单的三行导航栏到后面响应式的导航栏&#xff0c;其实可以在这个的基础上慢慢优化&#xff0c;就可以得到一个日常使用设计的导航栏。设计步骤也和之前的类似。 一、实现步骤 1、先下载安装好npm install douyinfe/semi-icons 2、引…

【中间件快速入门】什么是Redis

现在后端开发会用到各种中间件&#xff0c;一不留神项目可能在哪天就要用到一个我们之前可能听过但是从来没接触过的中间件&#xff0c;这个时候对于开发人员来说&#xff0c;如果你不知道这个中间件的设计逻辑和使用方法&#xff0c;那在后面的开发和维护工作中可能就会比较吃…

将 OneLake 数据索引到 Elasticsearch - 第二部分

作者&#xff1a;来自 Elastic Gustavo Llermaly 及 Jeffrey Rengifo 本文分为两部分&#xff0c;第二部分介绍如何使用自定义连接器将 OneLake 数据索引并搜索到 Elastic 中。 在本文中&#xff0c;我们将利用第 1 部分中学到的知识来创建 OneLake 自定义 Elasticsearch 连接器…

“AI教学实训系统:打造未来教育的超级引擎

嘿&#xff0c;各位教育界的伙伴们&#xff0c;今天我要跟你们聊聊一个绝对能让你们眼前一亮的教学神器——AI教学实训系统。作为资深产品经理&#xff0c;我可是亲眼见证了这款系统如何颠覆传统教学&#xff0c;成为未来教育的超级引擎。 一、什么是AI教学实训系统&#xff1f…

Linux下php8安装phpredis扩展的方法

Linux下php8安装phpredis扩展的方法 下载redis扩展执行安装编辑php.ini文件重启php-fpmphpinfo 查看 下载redis扩展 前提是已经安装好redis服务了 php-redis下载地址 https://github.com/phpredis/phpredis 执行命令 git clone https://github.com/phpredis/phpredis.git执行…

基于SMPL的三维人体重建-深度学习经典方法之VIBE

本文以开源项目VIBE[1-2]为例&#xff0c;介绍下采用深度学习和SMPL模板的从图片进行三维人体重建算法的整体流程。如有错误&#xff0c;欢迎评论指正。 一.算法流程 包含生成器模块和判别器模块&#xff0c;核心贡献就在于引入了GRU模块&#xff0c;使得当前帧包含了先前帧的先…

2.1.3 第一个工程,点灯!

新建工程 点击菜单栏左上角&#xff0c;新建工程或者选择“文件”-“新建工程”&#xff0c;选择工程类型“标准工程”选择设备类型和编程语言&#xff0c;并指定工程文件名及保存路径&#xff0c;如下图所示&#xff1a; 选择工程类型为“标准工程” 选择主模块机型&#x…

CVE-2025-0411 7-zip 漏洞复现

文章目录 免责申明漏洞描述影响版本漏洞poc漏洞复现修复建议 免责申明 本文章仅供学习与交流&#xff0c;请勿用于非法用途&#xff0c;均由使用者本人负责&#xff0c;文章作者不为此承担任何责任 漏洞描述 此漏洞 &#xff08;CVSS SCORE 7.0&#xff09; 允许远程攻击者绕…

mysql 学习6 DML语句,对数据库中的表进行 增 删 改 操作

添加数据 我们对 testdatabase 数据中 的 qqemp 这张表进行 增加数据&#xff0c;在这张表 下 打开 命令行 query console 在 软件中就是打开命令行的意思 可以先执行 desc qqemp; 查看一下当前表的结构。 插入一条数据 到qqemp 表&#xff0c;插入时要每个字段都有值 insert…

[特殊字符]【计算机视觉】r=2 采样滤波器全解析 ✨

Hey小伙伴们&#xff01;今天来给大家分享一个在 计算机视觉 领域中非常有趣但又超级重要的概念——r2 采样滤波器&#xff08;Sampling Filter with r2&#xff09;。通过这种滤波器&#xff0c;我们可以在图像降采样的过程中有效地减少混叠效应&#xff0c;提升图像质量。 如…

数据库SQLite和SCADA DIAView应用教程

课程简介 此系列课程大纲主要包含七个课时。主要使用到的开发工具有&#xff1a;SQLite studio 和 SCADA DIAView。详细的可成内容大概如下&#xff1a; 1、SQLite 可视化管理工具SQLite Studio &#xff1a;打开数据库和查询数据&#xff1b;查看视频 2、创建6个变量&#x…

【开源免费】基于Vue和SpringBoot的景区民宿预约系统(附论文)

本文项目编号 T 162 &#xff0c;文末自助获取源码 \color{red}{T162&#xff0c;文末自助获取源码} T162&#xff0c;文末自助获取源码 目录 一、系统介绍二、数据库设计三、配套教程3.1 启动教程3.2 讲解视频3.3 二次开发教程 四、功能截图五、文案资料5.1 选题背景5.2 国内…

[Spring] Gateway详解

&#x1f338;个人主页:https://blog.csdn.net/2301_80050796?spm1000.2115.3001.5343 &#x1f3f5;️热门专栏: &#x1f9ca; Java基本语法(97平均质量分)https://blog.csdn.net/2301_80050796/category_12615970.html?spm1001.2014.3001.5482 &#x1f355; Collection与…

Pandas基础02(DataFrame创建/索引/切片/属性/方法/层次化索引)

DataFrame数据结构 DataFrame 是一个二维表格的数据结构&#xff0c;类似于数据库中的表格或 Excel 工作表。它由多个 Series 组成&#xff0c;每个 Series 共享相同的索引。DataFrame 可以看作是具有列名和行索引的二维数组。设计初衷是将Series的使用场景从一维拓展到多维。…

矩阵快速幂

矩阵快速幂&#xff1a; 高效计算矩阵的幂次&#xff08;如A^n&#xff09;的一种算法&#xff0c;只适用于计算某一项&#xff0c;而不是全部项。 递推公式 如果 n为偶数&#xff0c;则&#xff1a; A^nA^(n/2)A^(n/2) 如果 nnn 为奇数&#xff0c;则&#xff1a; A^nA^(n-1…

复位信号的同步与释放(同步复位、异步复位、异步复位同步释放)

文章目录 背景前言一、复位信号的同步与释放1.1 同步复位1.1.1 综述1.1.2 优缺点 1.2 recovery time和removal time1.3 异步复位1.3.1 综述1.3.2 优缺点 1.4 同步复位 与 异步复位1.5 异步复位、同步释放1.5.1 总述1.5.2 机理1.5.3 复位网络 二、思考与补充2.1 复…

【Git版本控制器--3】Git的远程操作

目录 理解分布式版本控制系统 创建远程仓库 仓库被创建后的配置信息 克隆远程仓库 https克隆仓库 ssh克隆仓库 向远程仓库推送 拉取远程仓库 忽略特殊文件 为什么要忽略特殊文件&#xff1f; 如何配置忽略特殊文件&#xff1f; 配置命令别名 标签管理 理…

ios打包:uuid与udid

ios的uuid与udid混乱的网上信息 新人开发ios&#xff0c;发现uuid和udid在网上有很多帖子里是混淆的&#xff0c;比如百度下&#xff0c;就会说&#xff1a; 在iOS中使用UUID&#xff08;通用唯一识别码&#xff09;作为永久签名&#xff0c;通常是指生成一个唯一标识&#xf…