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

【HarmonyOS之旅】基于ArkTS开发(三) -> 兼容JS的类Web开发(四) -> 常见组件(一)

目录

1 -> List

1.1 -> 创建List组件

1.2 -> 添加滚动条

1.3 -> 添加侧边索引栏

1.4 -> 实现列表折叠和展开

1.5 -> 场景示例

2 -> dialog

2.1 -> 创建Dialog组件

2.2 -> 设置弹窗响应

2.3 -> 场景示例

3 -> form

3.1 -> 创建Form组件

3.2 -> 实现表单缩放

3.3 -> 设置Form样式

3.4 -> 添加响应事件

3.5 -> 场景示例


1 -> List

List是用来显示列表的组件,包含一系列相同宽度的列表项,适合连续、多行地呈现同类数据。

1.1 -> 创建List组件

在pages/index目录下的hml文件中创建一个List组件。

<!-- index.hml -->
<div class="container"> <list>    <list-item class="listItem"></list-item><list-item class="listItem"></list-item><list-item class="listItem"></list-item><list-item class="listItem"></list-item></list>
</div>
/* test.css */
.container {width:100%;height:100%;flex-direction: column;align-items: center;background-color: #F1F3F5;
}
.listItem{height: 20%;background-color:#d2e0e0;margin-top: 20px;
}

说明

  • <list-item-group>是<list>的子组件,实现列表分组功能,不能再嵌套<list>,可以嵌套<list-item>。

  • <list-item>是<list>的子组件,展示列表的具体项。

1.2 -> 添加滚动条

设置scrollbar属性为on即可在屏幕右侧生成滚动条,实现长列表或者屏幕滚动等效果。

<!-- index.hml -->
<div class="container"><list class="listCss" scrollbar="on" ><list-item class="listItem"></list-item><list-item class="listItem"></list-item><list-item class="listItem"></list-item><list-item class="listItem"></list-item><list-item class="listItem"></list-item><list-item class="listItem"></list-item></list>
</div> 
/* index.css */
.container {flex-direction: column;background-color: #F1F3F5;
}
.listItem{height: 20%;background-color:#d2e0e0;margin-top: 20px;
}
.listCss{height: 100%;scrollbar-color: #8e8b8b;scrollbar-width: 50px;
}

1.3 -> 添加侧边索引栏

设置indexer属性为自定义索引时,索引栏会显示在列表右边界处,indexer属性设置为true,默认为字母索引表。

<!-- index.hml -->
<div class="container">   <list class="listCss"  indexer="{{['#','1','2','3','4','5','6','7','8']}}" >  <list-item class="listItem"  section="#" ></list-item>   </list>
</div>
/* index.css */
.container{flex-direction: column;background-color: #F1F3F5;} 
.listCss{height: 100%;    flex-direction: column;columns: 1
}

说明

  • indexer属性生效需要flex-direction属性配合设置为column,且columns属性设置为1。

  • indexer可以自定义索引表,自定义时"#"必须要存在。

1.4 -> 实现列表折叠和展开

为List组件添加groupcollapse和groupexpand事件实现列表的折叠和展开。

<!-- index.hml -->
<div class="doc-page"><list style="width: 100%;" id="mylist"><list-item-group for="listgroup in list" id="{{listgroup.value}}" ongroupcollapse="collapse" ongroupexpand="expand"><list-item type="item" style="background-color:#FFF0F5;height:95px;"><div class="item-group-child"><text>One---{{listgroup.value}}</text></div></list-item><list-item type="item" style="background-color: #87CEFA;height:145px;" primary="true"><div class="item-group-child"><text>Primary---{{listgroup.value}}</text></div></list-item></list-item-group></list>
</div>
/* index.css */
.doc-page {flex-direction: column;background-color: #F1F3F5;
}
list-item{
margin-top:30px;
}
.top-list-item {width:100%;background-color:#D4F2E7;
}
.item-group-child {justify-content: center;align-items: center;width:100%;
}
// test.js
import prompt from '@system.prompt';
export default {data: {direction: 'column',list: []},onInit() {this.list = []this.listAdd = []for (var i = 1; i <= 2; i++) {var dataItem = {value: 'GROUP' + i,};this.list.push(dataItem);}},collapse(e) {prompt.showToast({message: 'Close ' + e.groupid})},expand(e) {prompt.showToast({message: 'Open ' + e.groupid})}
}

说明

  • groupcollapse和groupexpand事件仅支持list-item-group组件使用。

1.5 -> 场景示例

在本场景中,可以根据字母索引表查找对应联系人。

<!-- index.hml -->
<div class="doc-page"> <text style="font-size: 35px; font-weight: 500; text-align: center; margin-top: 20px; margin-bottom: 20px;"> <span>Contacts</span> </text> <list class="list" indexer="true"> <list-item class="item" for="{{namelist}}" type="{{$item.section}}" section="{{$item.section}}"> <div class="container"> <div class="in-container"> <text class="name">{{$item.name}}</text> <text class="number">18888888888</text> </div> </div> </list-item> <list-item type="end" class="item"> <div style="align-items:center;justify-content:center;width:750px;"> <text style="text-align: center;">Total: 10</text> </div> </list-item> </list> 
</div>
/* index.css */
.doc-page {width: 100%;height: 100%;flex-direction: column;background-color: #F1F3F5;
}
.list {width: 100%;height: 90%;flex-grow: 1;
}
.item {height: 120px;padding-left: 10%;border-top: 1px solid #dcdcdc;
}
.name {color: #000000;font-size: 39px;
}
.number {color: black;font-size: 25px;
}
.container {flex-direction: row;align-items: center;
}
.in-container {flex-direction: column;justify-content: space-around;
}
// test.js
export default { data: { namelist:[{ name: 'Zoey', section:'Z' },{ name: 'Quin', section:'Q' },{ name:'Sam', section:'S' },{ name:'Leo', section:'L' },{ name:'Zach', section:'Z' },{ name:'Wade', section:'W' },{ name:'Zoe', section:'Z' },{ name:'Warren', section:'W' },{ name:'Kyle', section:'K' },{ name:'Zaneta', section:'Z' }] }, onInit() { } }

2 -> dialog

Dialog组件用于创建自定义弹窗,通常用来展示用户当前需要或用户必须关注的信息或操作。

2.1 -> 创建Dialog组件

在pages/index目录下的hml文件中创建一个Dialog组件,并添加Button组件来触发Dialog。Dialog组件仅支持width、height、margin、margin-[left|top|right|bottom]、margin-[start|end]样式。

<!-- test.hml -->
<div class="doc-page"><dialog class="dialogClass" id="dialogId" dragable="true"><div class="content"><text>this is a dialog</text></div></dialog><button value="click me" onclick="openDialog"></button>
</div>
/* test.css */
.doc-page {width:100%;height:100%;flex-direction: column;align-items: center;justify-content: center;background-color: #F1F3F5;
}
.dialogClass{width: 80%;height: 250px;margin-start: 1%;
}
.content{width: 100%;height: 250px;justify-content: center;background-color: #e8ebec;border-radius: 20px;
}
text{width: 100%;height: 100%;text-align: center;
}
button{width: 70%;height: 60px;
}
/* test.js */
export default {//Touch to open the dialog box.openDialog(){this.$element('dialogId').show()},
}

2.2 -> 设置弹窗响应

点击页面上非Dialog的区域时,将触发cancel事件而关闭弹窗。同时也可以通过对Dialog添加show和close方法来显示和关闭弹窗。

<!-- test.hml -->
<div class="doc-page"><dialog class="dialogClass" id="dialogId" oncancel="canceldialog"><div class="dialogDiv"><text>dialog</text><button value="confirm" onclick="confirmClick"></button></div></dialog><button value="click me" onclick="openDialog"></button>
</div>
/* test.css */
.doc-page {width:100%;height:100%;flex-direction: column;align-items: center;justify-content: center;background-color: #F1F3F5;
}
.dialogClass{width: 80%;height: 300px;margin-start: 1%;
}
.dialogDiv{width: 100%;flex-direction: column;justify-content: center;align-self: center;
}
text{height: 100px;align-self: center;
}
button{align-self: center;margin-top: 20px;width: 60%;height: 80px;
}
/* test.js */
import prompt from '@system.prompt';
export default {canceldialog(e){prompt.showToast({message: 'dialogCancel'})},openDialog(){this.$element('dialogId').show()prompt.showToast({message: 'dialogShow'})},confirmClick(e) {this.$element('dialogId').close()prompt.showToast({message: 'dialogClose'})},
}

说明

  • 仅支持单个子组件。

  • Dialog属性、样式均不支持动态更新。

  • Dialog组件不支持focusable、click-effect属性。

2.3 -> 场景示例

在本场景中,可以通过Dialog组件实现一个日程表。弹窗在打开状态下,利用Textarea组件输入当前日程,点击确认按钮后获取当前时间并保存输入文本。最后以列表形式将各日程进行展示。

<!-- test.hml -->
<div class="doc-page"><text style="margin-top: 60px;margin-left: 30px;"><span>{{date}} events</span></text><div class="btndiv"><button type="circle" class="btn" onclick="addschedule">+</button></div>
<!--  for Render events data  --><list style="width: 100%;"><list-item type="item" for="schedulelist" style="width:100%;height: 200px;"><div class="schedulediv"><text class="text1">{{date}}  event</text><text class="text2">{{$item.schedule}}</text></div></list-item></list><dialog id="datedialog" oncancel="canceldialog" ><div class="dialogdiv"><div class="innertxt"><text class="text3">{{date}}</text><text class="text4">New event</text></div><textarea placeholder="Event information" onchange="getschedule" class="area" extend="true"></textarea><div class="innerbtn"><button type="text" value="Cancel" onclick="cancelschedule" class="btntxt"></button><button type="text" value="OK" onclick="setschedule" class="btntxt"></button></div></div></dialog>
</div>
/* test.css */
.doc-page {flex-direction: column;background-color: #F1F3F5;
}
.btndiv {width: 100%;height: 200px;flex-direction: column;align-items: center;justify-content: center;
}
.btn {radius:60px;font-size: 100px;background-color: #1E90FF;
}
.schedulediv {width: 100%;height: 200px;flex-direction: column;justify-content: space-around;padding-left: 55px;
}
.text1 {color: #000000;font-weight: bold;font-size: 39px;
}
.text2 {color: #a9a9a9;font-size: 30px;
}
.dialogdiv {flex-direction: column;align-items: center;
}
.innertxt {width: 320px;height: 160px;flex-direction: column;align-items: center;justify-content: space-around;
}
.text3 {font-family: serif;color: #1E90FF;font-size: 38px;
}
.text4 {color: #a9a9a9;font-size: 33px;
}
.area {width: 320px;border-bottom: 1px solid #1E90FF;
}
.innerbtn {width: 320px;height: 120px;justify-content: space-around;
}
.btntxt {text-color: #1E90FF;
}
/* test.js */
var info = null;
import prompt from '@system.prompt';
import router from '@system.router';
export default {data: {curYear:'',curMonth:'',curDay:'',date:'',schedule:'',schedulelist:[]},onInit() {// Obtain the current date. var date = new Date();this.curYear = date.getFullYear();this.curMonth = date.getMonth() + 1;this.curDay = date.getDate();this.date = this.curYear + '-' + this.curMonth + '-' + this.curDay;this.schedulelist = []},addschedule(e) {this.$element('datedialog').show()},canceldialog(e) {prompt.showToast({message: 'Event setting canceled.'})},getschedule(e) {info = e.value},cancelschedule(e) {this.$element('datedialog').close()prompt.showToast({message: 'Event setting canceled.'})},
//    Touch OK to save the data.setschedule(e) {if (e.text === '') {this.schedule = info} else {this.schedule = infovar addItem =  {schedule: this.schedule,}this.schedulelist.push(addItem)}this.$element('datedialog').close()}
}

3 -> form

Form是一个表单容器,支持容器内Input组件内容的提交和重置。

说明

从API Version 6开始支持。

3.1 -> 创建Form组件

在pages/index目录下的hml文件中创建一个Form组件。

<!-- test.hml -->
<div class="container"><form style="width: 100%; height: 20%">  <input type="text" style="width:80%"></input></form>
</div>
/* test.css */
.container {width:100%;height:100%;flex-direction: column;justify-content: center;align-items: center;background-color: #F1F3F5;
}

3.2 -> 实现表单缩放

为Form组件添加click-effect属性,实现点击表单后的缩放效果。

<!-- test.hml -->
<div class="container"><form  id="formId" class="formClass" click-effect="spring-large"><input type="text"></input>  </form>
</div>

3.3 -> 设置Form样式

通过为Form添加background-color和border属性,来设置表单的背景颜色和边框。

/* test.css */
.container {width: 100%;height: 100%;flex-direction: column;align-items: center;justify-content: center;background-color: #F1F3F5;
}
.formClass{width: 80%;height: 100px;padding: 10px;border: 1px solid #cccccc;
}

3.4 -> 添加响应事件

为Form组件添加submit和reset事件,来提交表单内容或重置表单选项。

<!-- test.hml -->
<div class="container"><form onsubmit='onSubmit' onreset='onReset' class="form"><div style="width: 100%;justify-content: center;"><label>Option 1</label><input type='radio' name='radioGroup' value='radio1'></input><label>Option 2</label><input type='radio' name='radioGroup' value='radio2'></input></div><div style="width: 100%;justify-content: center; margin-top: 20px"><input type="submit" value="Submit" style="width:120px; margin-right:20px;" >   </input><input type="reset" value="Reset" style="width:120px;"></input></div></form>
</div>
/* index.css */
.container{width: 100%;height: 100%;flex-direction: column;justify-items: center;align-items: center;background-color: #F1F3F5;
}
.form{width: 100%;height: 30%;margin-top: 40%;flex-direction: column;justify-items: center;align-items: center;
}
/* test.js */
import prompt from '@system.prompt';
export default{onSubmit(result) {prompt.showToast({message: result.value.radioGroup})},onReset() {prompt.showToast({message: 'Reset All'})}
}

3.5 -> 场景示例

在本场景中,可以选择相应选项并提交或重置数据。

创建Input组件,分别设置type属性为checkbox(多选框)和radio(单选框),再使用Form组件的onsubmit和onreset事件实现表单数据的提交与重置。

<!-- test.hml -->
<div class="container"><form onsubmit="formSubmit" onreset="formReset"><text style="font-size: 30px; margin-bottom: 20px; margin-top: 100px;"><span > Form </span></text><div style="flex-direction: column;width: 90%;padding: 30px 0px;"><text class="txt">Select 1 or more options</text><div style="width: 90%;height: 150px;align-items: center;justify-content: space-around;"><label target="checkbox1">Option 1</label><input id="checkbox1" type="checkbox" name="checkbox1"></input><label target="checkbox2">Option 2</label><input id="checkbox2" type="checkbox" name="checkbox2"></input></div><divider style="margin: 20px 0px;color: pink;height: 5px;"></divider><text class="txt">Select 1 option</text><div style="width: 90%;height: 150px;align-items: center;justify-content: space-around;"><label target="radio1">Option 1</label><input id="radio1" type="radio" name="myradio"></input><label target="radio2">Option 2</label><input id="radio2" type="radio" name="myradio"></input></div><divider style="margin: 20px 0px;color: pink;height: 5px;"></divider><text class="txt">Text box</text><input type="text" placeholder="Enter content." style="margin-top: 50px;"></input><div style="width: 90%;align-items: center;justify-content: space-between;margin: 40px;"><input type="submit">Submit</input><input type="reset">Reset</input></div></div></form>
</div>
/* index.css */
.container {width: 100%;height: 100%;flex-direction:column;align-items:center;background-color:#F1F3F5;
}
.txt {font-size:33px;font-weight:bold;color:darkgray;
}
label{font-size: 20px;
}
/* test.js */
import prompt from '@system.prompt';
export default {formSubmit() {prompt.showToast({message: 'Submitted.'})},formReset() {prompt.showToast({message: 'Reset.'})}
}


感谢各位大佬支持!!!

互三啦!!!

相关文章:

【HarmonyOS之旅】基于ArkTS开发(三) -> 兼容JS的类Web开发(四) -> 常见组件(一)

目录 1 -> List 1.1 -> 创建List组件 1.2 -> 添加滚动条 1.3 -> 添加侧边索引栏 1.4 -> 实现列表折叠和展开 1.5 -> 场景示例 2 -> dialog 2.1 -> 创建Dialog组件 2.2 -> 设置弹窗响应 2.3 -> 场景示例 3 -> form 3.1 -> 创建…...

【加餐】使⽤指针实现链表

【加餐】使⽤指针实现链表 ​ 面向过程方式和面向对象方式&#xff08;把面向过程的封装一下就行了&#xff09;是两种不同的编程方法论...

用 Python 绘制爱心形状的简单教程

1. 引言 在本教程中&#xff0c;我们将学习如何使用 Python 和 Matplotlib 库来绘制一个简单的爱心形状。这是一个有趣且简单的项目&#xff0c;适合初学者练习图形绘制和数据可视化。 2. 环境准备 首先&#xff0c;确保您的系统上安装了 Python 和 Matplotlib 库。如果还未…...

DeepSeek安装

安装运行环境 https://ollama.com/ 安装验证 cmd指令 ollama -v 安装运行模型 https://ollama.com/library/deepseek-r1:14b-qwen-distill-q4_K_M 例如&#xff1a; ollama run deepseek-r1:1.5b-qwen-distill-q4_K_M 结果 再次使用时&#xff0c;直接cmd运行上一步的ru…...

Git--使用教程

Git的框架讲解 Git 是一个分布式版本控制系统&#xff0c;其架构设计旨在高效地管理代码版本&#xff0c;支持分布式协作&#xff0c;并确保数据的完整性和安全性。 Git 的核心组件&#xff1a; 工作区&#xff08;Working Directory&#xff09;&#xff1a; - 作区是你在本…...

【HTML性能优化】提升网站加载速度:GZIP、懒加载与资源合并

系列文章目录 01-从零开始学 HTML&#xff1a;构建网页的基本框架与技巧 02-HTML常见文本标签解析&#xff1a;从基础到进阶的全面指南 03-HTML从入门到精通&#xff1a;链接与图像标签全解析 04-HTML 列表标签全解析&#xff1a;无序与有序列表的深度应用 05-HTML表格标签全面…...

C#从XmlDocument提取完整字符串

方法1&#xff1a;通过XmlDocument的OuterXml属性&#xff0c;见XmlDocument类 该方法获得的xml字符串是不带格式的&#xff0c;可读性差 方法2&#xff1a;利用XmlWriterSettings控制格式等一系列参数&#xff0c;见XmlWriterSettings类 例子&#xff1a; using System.IO; …...

wordpress每隔24小时 随机推荐一个指定分类下的置顶内容。

在WordPress中实现每隔24小时随机推荐一个指定分类下的置顶内容&#xff0c;可以通过以下步骤实现&#xff1a; 1. 创建自定义函数 在主题的functions.php文件中添加以下代码&#xff0c;用于创建一个定时任务&#xff0c;每隔24小时随机选择一个置顶文章并存储到选项中&…...

《chatwise:DeepSeek的界面部署》

ChatWise&#xff1a;DeepSeek的界面部署 摘要 本文详细描述了DeepSeek公司针对其核心业务系统进行的界面部署工作。从需求分析到技术实现&#xff0c;再到测试与优化&#xff0c;全面阐述了整个部署过程中的关键步骤和解决方案。通过本文&#xff0c;读者可以深入了解DeepSee…...

HTTP请求响应周期步骤

一个典型的 HTTP 请求/响应周期 从建立连接开始,经过客户端向服务器发送请求、服务器处理请求并返回响应,最终关闭连接。这个过程可以分为多个阶段,以下是详细的步骤: 一、建立连接(TCP连接) 客户端发起连接请求:在HTTP通信中,客户端通常是浏览器,首先通过 DNS 查询…...

synchronized, volatile 在 DCL 的作用

背景 最近在看设计模式&#xff0c;在单例模式的 Double Check Lock&#xff08;DCL&#xff09;中&#xff0c;存在两个关键字&#xff1a;volatile & synchronized。 之前都知道 DCL 怎么写&#xff0c;直接套娃。但是这两关键字在单例里面的作用还没深究过&#xff0c…...

Java进阶笔记(中级)

-----接Java进阶笔记&#xff08;初级&#xff09;----- 目录 集合多线程 集合 ArrayList 可以通过List来接收ArrayList对象&#xff08;因为ArrayList实现了List接口&#xff09; 方法&#xff1a;接口名 柄名 new 实现了接口的类(); PS: List list new ArrayList();遍历…...

人生总有终点,不必好高骛远

夕阳西下&#xff0c;我漫步在河堤上。河水缓缓流淌&#xff0c;倒映着天边最后一抹晚霞。岸边垂柳依依&#xff0c;枝条轻拂水面&#xff0c;荡起一圈圈涟漪。这涟漪由近及远&#xff0c;渐渐消散在暮色中&#xff0c;如同我们每个人在时间长河中泛起的微澜。 记得年少时&…...

C#中堆和栈的区别

C#中的堆&#xff08;Heap&#xff09;和栈&#xff08;Stack&#xff09;详解 基本概念 栈&#xff08;Stack&#xff09; 栈是一个后进先出&#xff08;LIFO&#xff09;的内存结构由系统自动分配和释放存储空间连续&#xff0c;大小固定主要用于存储值类型和对象引用 堆…...

如何利用i18n实现国际化

1.首先新建i18.js文件 // i18n配置 import { createI18n } from vue-i18n // import ElementPlus from element-plus import zhCn from element-plus/es/locale/lang/zh-cn import zh from ./zh-cn import en from ./en import ru from ./ru const messages {en_US: {...en,//…...

SpringMVC响应

第一章&#xff1a;数据处理及跳转 1. 结果跳转方式 ①.ModelAndView 设置ModelAndView对象 , 根据view的名称 , 和视图解析器跳到指定的页面 . <bean id"templateResolver" class"org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolv…...

深入理解特征值与稳定性密码:以弹簧 - 质量 - 阻尼典型二阶系统为例

从看特征值决定稳定性的原因 摘要 本文以弹簧 - 质量 - 阻尼系统这一典型二阶系统为研究对象&#xff0c;深入剖析特征值决定系统稳定性的内在原因。通过详细的数学推导和直观的物理意义阐释&#xff0c;全面揭示了特征值与系统稳定性之间的紧密关联&#xff0c;为理解和分析…...

python pandas 读取合并单元格并保留合并信息

读取合并单元格并保留合并信息 当我们只是使用 pandas 的 read_excel 方法读取 Excel 文件时&#xff0c;我们可能会遇到一个很棘手的问题&#xff1a;合并单元格的信息将会丢失&#xff0c;从而导致我们的数据出现重复或缺失的情况。 在本篇文章中将介绍使用 pandas 正确地读…...

Go-Gin Web 框架完整教程

1. 环境准备 1.1 Go 环境安装 Go 语言&#xff08;或称 Golang&#xff09;是一个开源的编程语言&#xff0c;由 Google 开发。在开始使用 Gin 框架之前&#xff0c;我们需要先安装 Go 环境。 安装步骤&#xff1a; 访问 Go 官网下载页面&#xff1a;https://golang.org/dl…...

机器学习专业毕设选题推荐合集 人工智能

目录 前言 毕设选题 开题指导建议 更多精选选题 选题帮助 最后 前言 大家好,这里是海浪学长毕设专题! 大四是整个大学期间最忙碌的时光&#xff0c;一边要忙着准备考研、考公、考教资或者实习为毕业后面临的升学就业做准备,一边要为毕业设计耗费大量精力。学长给大家整理…...

Java程序员 面试如何介绍项目经验?

项目经历是面试过程中重点问的&#xff0c;但是很多人在回答的时候往往会有问题&#xff1a; 重点是介绍项目&#xff0c;而忽略了个人的经历。 经历是你做了什么、你怎么做的、做完后的结果。例如&#xff1a;项目中的哪些部分是你做的&#xff1f;你是不是核心人员&#xf…...

YONBIP后端环境搭建-IDEA

1、IDEA环境搭建 1.1、插件安装 打开设置窗口&#xff0c;添加自定义插件存储库路径。 https://nccdev.yonyou.com/ide/idea/latest/updatePlugin.xml 在 Marketplace 中搜索 YonBuilder Premium开发者工具 &#xff0c;点击安装。 1.2、Home配置 点击Home配置按钮&#xf…...

Java 微服务实用指南(一)

Java 微服务&#xff1a;基础 要真正理解 Java 微服务&#xff0c;就必须从最基本的东西开始&#xff1a;为人诟病的 Java 大型单体应用是什么&#xff0c;它的优点和缺点是什么。 什么是 Java 大型单体应用&#xff1f; 假设你正在为一家银行或一家金融科技初创公司工作。你为…...

Windows图形界面(GUI)-QT-C/C++ - QT Frame

公开视频 -> 链接点击跳转公开课程博客首页 -> ​​​链接点击跳转博客主页 目录 一、概述 二、使用场景 1. 分隔内容区域 2. 装饰性边框 3. 自定义控件容器 三、常见样式 1. 框架形状&#xff08;Shape&#xff09; 2. 框架阴影&#xff08;Shadow&#xff09;…...

优选算法合集————双指针(专题二)

好久都没给大家带来算法专题啦&#xff0c;今天给大家带来滑动窗口专题的训练 题目一&#xff1a;长度最小的子数组 题目描述&#xff1a; 给定一个含有 n 个正整数的数组和一个正整数 target 。 找出该数组中满足其和 ≥ target 的长度最小的 连续子数组 [numsl, numsl1, …...

WebSocket协议里客户端发送给服务器的数据会用4字节的掩码循环异或的分析

首先&#xff0c;我需要回顾WebSocket协议中对掩码处理的具体要求。根据RFC 6455&#xff0c;客户端发送到服务器的帧必须使用掩码&#xff0c;而服务器发送的帧不需要掩码。掩码是4字节的&#xff0c;应用于有效载荷数据&#xff0c;每个字节依次与掩码的对应字节异或&#xf…...

【字节青训营-9】:初探字节微服务框架 Hertz 基础使用及进阶(下)

本文目录 一、Hertz中间件Recovery二、Hertz中间件跨资源共享三、Hertz 响应四、Hertz请求五、Hertz中间件Session 一、Hertz中间件Recovery Recovery中间件是Hertz框架预置的中间件&#xff0c;使用server.Default()可以默认注册该中间件&#xff0c;为Hertz框架提供panic回复…...

新版AndroidStudio 修改 jdk版本

一、问题 之前&#xff0c;在安卓项目中配置JDK和Gradle的过程非常直观&#xff0c;只需要进入Android Studio的File菜单中的Project Structure即可进行设置&#xff0c;十分方便。 如下图可以在这修改JDK: 但是升级AndroidStudio之后&#xff0c;比如我升级到了Android Stu…...

cocos spine执行动画报错Cannot read properties of null (reading ‘data‘)

cocos v3.8.3 当想this.spine.setAnimation(0, "action1", false);播放spine动画时报错↓ 解决方法一&#xff1a; 在setAnimation之前调用this.spine.__preload() 解决方法二&#xff1a; 不要让spine或其父节点通过active显隐...

笔记:新能源汽车零部件功率级测试怎么进行?

摘要:本文旨在梳理主机厂对新能源汽车核心零部件功率级测试需求,通过试验室的主流设备仪器集成,快速实现试验方案搭建,并体现测试测量方案的时效性、便捷性优势。目标是通过提升实现设备的有效集成能力、实现多设备测试过程的有效协同、流程化测试,可快速采集、分析当前数…...

【starrocks学习】之将starrocks表同步到hive

目录 方法 1&#xff1a;通过HDFS导出数据 1. 将StarRocks表数据导出到HDFS 2. 在Hive中创建外部表 3. 验证数据 方法 2&#xff1a;使用Apache Spark同步 1. 添加StarRocks和Hive的依赖 2. 使用Spark读取StarRocks数据并写入Hive 3. 验证数据 方法 3&#xff1a;通过…...

Linux提权--SUDO提权

​sudo​ 是 Linux 中常用的特权管理工具&#xff0c;允许普通用户以其他用户&#xff08;通常是 root 用户&#xff09;的身份运行命令。如果配置不当&#xff0c;攻击者可能通过滥用 sudo​ 权限来提升自己的权限。 一.常见的 sudo 提权方法&#xff1a; 误配置的 sudo 权限&…...

【AIGC提示词系统】基于 DeepSeek R1 + Claude 的新年运势占卜系统设计与实现

提示词在最下方 DeepSeek R1调试了整体的提示词&#xff0c;使用Claude进行渲染 引言 在人工智能与传统文化交融的今天&#xff0c;如何让 AI 充分理解并传递东方玄学文化的精髓&#xff0c;成为一个极具挑战性的课题。本文将详细介绍一个基于 Claude 的新年运势占卜系统的设计…...

11. Global Object 全局对象的使用

Global Object 全局对象 1 引言2 制作全局对象3 调用全局对象4 扩展使用1 引言 全局对象适用于大量重复的对象,比如阀门,电机等,如果这些设备的基本逻辑与状态都是一样的,那么就可以使用全局对象的方法来做HMI,省时省力。并且在后期修改的时候只需要修改全局对象即可。 …...

Java synchronized锁升级

偏向锁、轻量级锁和重量级锁是Java中synchronized关键字的三种锁状态&#xff0c;用于优化多线程环境下的性能。以下是它们的简要说明&#xff1a; 1. 偏向锁&#xff08;Biased Locking&#xff09; 目的&#xff1a;减少无竞争时的锁开销。适用场景&#xff1a;只有一个线程…...

【Hadoop】Hadoop的HDFS

这里写目录标题 HDFS概述HDFS产出背景及定义HDFS产生背景HDFS定义 HDFS优缺点HDFS优点HDFS缺点 HDFS组成架构HDFS文件块大小 HDFS的Shell操作常用命令实操准备工作上传下载HDFS直接操作 HDFS的API操作客户端环境准备HDFS的API案例实操HDFS文件上传HDFS文件下载HDFS文件更名和移…...

JAVA异步的TCP 通讯-客户端

一、客户端代码示例 import java.io.IOException; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.nio.channels.AsynchronousSocketChannel; import java.nio.channels.CompletionHandler; import java.util.concurrent.ExecutorService; impo…...

4.回归与聚类算法 4.1线性回归

4.1.1 线性回归的原理 1 线性回归应用场景&#xff1a; 房价预测 销售额度预测 金融&#xff1a;贷款额度预测&#xff0c;利用线性回归以及系数分析因子 2 什么是线性回归 1&#xff09; 定义&#xff1a;利用回归方程&#xff08;函数&#xff09;对一个或者多个自变量…...

联想拯救者开机进入bios

如果你的联想拯救者&#xff08;Lenovo Legion&#xff09;笔记本电脑开机后直接进入 BIOS 设置界面&#xff0c;可能是以下原因之一导致的。以下是解决方法&#xff1a; 1. 检查启动顺序 进入 BIOS 后&#xff0c;找到 Boot&#xff08;启动&#xff09;选项卡。检查启动顺序…...

【贪心算法篇】:“贪心”之旅--算法练习题中的智慧与策略(四)

✨感谢您阅读本篇文章&#xff0c;文章内容是个人学习笔记的整理&#xff0c;如果哪里有误的话还请您指正噢✨ ✨ 个人主页&#xff1a;余辉zmh–CSDN博客 ✨ 文章所属专栏&#xff1a;贪心算法篇–CSDN博客 文章目录 前言例题1.合并区间2.无重叠的区间3.用最少数量的箭引爆气球…...

Junit5使用教程(3)

第三部分&#xff1a;JUnit 5 进阶 3. 动态测试 一、动态测试是什么&#xff1f; 动态测试&#xff08;Dynamic Test&#xff09;允许在运行时生成测试用例&#xff0c;而不是在编译时通过 Test 静态定义。它通过 TestFactory 注解标记的方法动态生成一组测试用例&#xff0…...

WPS中解除工作表密码保护(忘记密码)

1.下载vba插件 项目首页 - WPS中如何启用宏附wps.vba.exe下载说明分享:WPS中如何启用宏&#xff1a;附wps.vba.exe下载说明本文将详细介绍如何在WPS中启用宏功能&#xff0c;并提供wps.vba.exe文件的下载说明 - GitCode 并按照步骤安装 2.wps中点击搜索&#xff0c;输入开发…...

通向AGI之路:人工通用智能的技术演进与人类未来

文章目录 引言:当机器开始思考一、AGI的本质定义与技术演进1.1 从专用到通用:智能形态的范式转移1.2 AGI发展路线图二、突破AGI的五大技术路径2.1 神经符号整合(Neuro-Symbolic AI)2.2 世界模型架构(World Models)2.3 具身认知理论(Embodied Cognition)三、AGI安全:价…...

kamailio-osp模块

该文档详细讲解了如何在Kamailio中配置和使用OSP模块&#xff08;Open Settlement Protocol Module&#xff09;&#xff0c;以实现基于ETSI标准的安全多边对等互联&#xff08;Secure Multi-Lateral Peering&#xff09;。以下是核心内容的总结&#xff1a; 1. 模块功能 OSP模…...

【Linux网络编程】:URL(encode),HTTP协议,telnet工具

&#x1f381;个人主页&#xff1a;我们的五年 &#x1f50d;系列专栏&#xff1a;Linux网络编程 &#x1f337;追光的人&#xff0c;终会万丈光芒 &#x1f389;欢迎大家点赞&#x1f44d;评论&#x1f4dd;收藏⭐文章 ​ Linux网络编程笔记&#xff1a; https://mp.csdn…...

SpringMVC SpringMVC响应 一、数据处理及跳转

1. 结果跳转方式 ①.ModelAndView 设置ModelAndView对象 , 根据view的名称 , 和视图解析器跳到指定的页面 <bean id"templateResolver" class"org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver"><property name"p…...

C++SLT(三)——list

目录 一、list的介绍二、list的使用list的定义方式 三、list的插入和删除push_back和pop_backpush_front和pop_frontinserterase 四、list的迭代器使用五、list的元素获取六、list的大小控制七、list的操作函数sort和reversemergeremoveremove_ifuniqueassignswap 一、list的介…...

基于Coze平台实现抖音链接提取文案转小红书文案的智能体开发全流程解析

文章目录 引言:跨平台内容运营的AI解法实例最终效果1. 平台特性对比与转化需求分析1.1 用户画像与内容风格对比1.2 文案转化核心需求2. Coze平台技术架构解析2.1 Coze核心能力矩阵2.2 关键技术组件选型3. 智能体工作流设计3.1 完整处理流程3.2 关键节点说明4. 核心模块实现详解…...

32. 最长有效括号

动态规划 dp[i]表示以i下标为结尾的最长有效括号的长度&#xff0c;取dp[i]中的最大值即可。 i从1开始判断&#xff0c;只有s[i])才需要判断&#xff1a; 如果s[i-1](&#xff0c;那么dp[i]dp[i-2]2&#xff0c;注意判断i-2的范围否则&#xff0c;如果dp[i-1]>0&#xff0…...

Linux常见问题解决方法--2

如何反爬 后台对访问进行统计&#xff0c;如果单个 IP 访问超过阈值&#xff0c;予以封锁 后台对访问进行统计&#xff0c;如果单个 session 访问超过阈值&#xff0c;予以封锁 后台对访问进行统计&#xff0c;如果单个 userAgent 访问超过阈值&#xff0c;予以封锁 以上的组…...