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

鸿蒙中自定义slider实现字体大小变化

ui:

import { display, mediaquery, router } from '@kit.ArkUI'
import CommonConstants from './CommonConstants';
import PreferencesUtil from './PreferencesUtil';
import StyleConstants from './StyleConstants';// 字体大小
@Entry
@Component
struct FontSize {@State TopBar: string[] = ['取消', '字体大小预览', '确定']@State sliderTitle: string[] = ['A', '标准', '', 'A']@State changeFontSize: number = 12;@State outSetValueOne: number = 40@State offsetX: number = 0;@State lineW: number = 0@State circleW: number = 18@State circleH: number = 18@State minW: number = 0@State scaleArr: number[] = []@State acrossOrVertical: string = ''aboutToAppear() {PreferencesUtil.getChangeFontSize().then((value) => {this.changeFontSize = value;if (this.changeFontSize === CommonConstants.SET_SIZE_EXTRA_LARGE) {this.offsetX = CommonConstants.SET_SCALE_EXTRA_LARGE_VERTICAL} else if (this.changeFontSize === CommonConstants.SET_SIZE_LARGE) {this.offsetX = CommonConstants.SET_SCALE_LARGE_VERTICAL} else if (this.changeFontSize === CommonConstants.SET_SIZE_NORMAL) {this.offsetX = CommonConstants.SET_SCALE_NORMAL_VERTICAL} else if (this.changeFontSize === CommonConstants.SET_SIZE_SMALL) {this.offsetX = CommonConstants.SET_SCALE_SMALL_VERTICAL}});this.scaleArr = [CommonConstants.SET_SCALE_SMALL_VERTICAL, CommonConstants.SET_SCALE_NORMAL_VERTICAL,CommonConstants.SET_SCALE_LARGE_VERTICAL, CommonConstants.SET_SCALE_EXTRA_LARGE_VERTICAL]this.lineW = CommonConstants.SET_SCALE_EXTRA_LARGE_VERTICAL //pad竖屏}callbackOffset() {// if (this.offsetX === 18) {//   return 0 - this.circleW / 2// }return this.offsetX - this.circleW / 2}changeFontSize_Across() {if (this.offsetX > CommonConstants.SET_SCALE_SMALL_ACROSS &&this.offsetX <= CommonConstants.SET_SCALE_NORMAL_ACROSS - CommonConstants.SET_SCALE_AVERAGE_ACROSS) {this.changeFontSize = CommonConstants.SET_SIZE_SMALL} else if (this.offsetX >CommonConstants.SET_SCALE_NORMAL_ACROSS - CommonConstants.SET_SCALE_AVERAGE_ACROSS / 2 &&this.offsetX <= CommonConstants.SET_SCALE_LARGE_ACROSS - CommonConstants.SET_SCALE_AVERAGE_ACROSS) {this.changeFontSize = CommonConstants.SET_SIZE_NORMAL} else if (this.offsetX >CommonConstants.SET_SCALE_LARGE_ACROSS - CommonConstants.SET_SCALE_AVERAGE_ACROSS &&this.offsetX <=CommonConstants.SET_SCALE_EXTRA_LARGE_ACROSS - CommonConstants.SET_SCALE_AVERAGE_ACROSS) {this.changeFontSize = CommonConstants.SET_SIZE_LARGE} else if (this.offsetX >CommonConstants.SET_SCALE_EXTRA_LARGE_ACROSS - CommonConstants.SET_SCALE_AVERAGE_ACROSS &&this.offsetX <= CommonConstants.SET_SCALE_EXTRA_LARGE_ACROSS) {this.changeFontSize = CommonConstants.SET_SIZE_EXTRA_LARGE}}changeFontSize_Vertical() {if (this.offsetX > CommonConstants.SET_SCALE_SMALL_VERTICAL &&this.offsetX <=CommonConstants.SET_SCALE_NORMAL_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL) {this.changeFontSize = CommonConstants.SET_SIZE_SMALL} else if (this.offsetX >CommonConstants.SET_SCALE_NORMAL_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL / 2 &&this.offsetX <= CommonConstants.SET_SCALE_LARGE_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL) {this.changeFontSize = CommonConstants.SET_SIZE_NORMAL} else if (this.offsetX >CommonConstants.SET_SCALE_LARGE_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL &&this.offsetX <=CommonConstants.SET_SCALE_EXTRA_LARGE_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL) {this.changeFontSize = CommonConstants.SET_SIZE_LARGE} else if (this.offsetX >CommonConstants.SET_SCALE_EXTRA_LARGE_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL &&this.offsetX <= CommonConstants.SET_SCALE_EXTRA_LARGE_VERTICAL) {this.changeFontSize = CommonConstants.SET_SIZE_EXTRA_LARGE}}onTouchGetOffsetX_Vertical(touchesX: number) {AlertDialog.show({ message: "1" })if (touchesX > CommonConstants.SET_SCALE_SMALL_VERTICAL && touchesX <CommonConstants.SET_SCALE_NORMAL_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL) {this.offsetX = CommonConstants.SET_SCALE_SMALL_VERTICAL}if (touchesX >CommonConstants.SET_SCALE_NORMAL_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL &&touchesX <CommonConstants.SET_SCALE_LARGE_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL) {this.offsetX = CommonConstants.SET_SCALE_NORMAL_VERTICAL}if (touchesX >CommonConstants.SET_SCALE_LARGE_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL &&touchesX <CommonConstants.SET_SCALE_EXTRA_LARGE_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL) {this.offsetX = CommonConstants.SET_SCALE_LARGE_VERTICAL}if (touchesX >CommonConstants.SET_SCALE_EXTRA_LARGE_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL &&touchesX < CommonConstants.SET_SCALE_EXTRA_LARGE_VERTICAL) {this.offsetX = CommonConstants.SET_SCALE_EXTRA_LARGE_VERTICAL}}onTouchGetOffsetX_Across(touchesX: number) {AlertDialog.show({ message: "2" })if (touchesX > CommonConstants.SET_SCALE_SMALL_ACROSS &&touchesX < CommonConstants.SET_SCALE_NORMAL_ACROSS - CommonConstants.SET_SCALE_AVERAGE_ACROSS) {this.offsetX = CommonConstants.SET_SCALE_SMALL_ACROSS}if (touchesX > CommonConstants.SET_SCALE_NORMAL_ACROSS - CommonConstants.SET_SCALE_AVERAGE_ACROSS &&touchesX < CommonConstants.SET_SCALE_LARGE_ACROSS - CommonConstants.SET_SCALE_AVERAGE_ACROSS) {this.offsetX = CommonConstants.SET_SCALE_NORMAL_ACROSS}if (touchesX > CommonConstants.SET_SCALE_LARGE_ACROSS - CommonConstants.SET_SCALE_AVERAGE_ACROSS &&touchesX < CommonConstants.SET_SCALE_EXTRA_LARGE_ACROSS - CommonConstants.SET_SCALE_AVERAGE_ACROSS) {this.offsetX = CommonConstants.SET_SCALE_LARGE_ACROSS}if (touchesX > CommonConstants.SET_SCALE_EXTRA_LARGE_ACROSS - CommonConstants.SET_SCALE_AVERAGE_ACROSS &&touchesX < CommonConstants.SET_SCALE_EXTRA_LARGE_ACROSS) {this.offsetX = CommonConstants.SET_SCALE_EXTRA_LARGE_ACROSS}}build() {Column() {Text('实例文案-----你猜你猜猜').fontSize(this.changeFontSize + StyleConstants.UNIT_FP)Text(`相应字体大小:${this.changeFontSize}`).fontSize(this.changeFontSize + StyleConstants.UNIT_FP)Text(`偏移距离:${this.offsetX}`).fontSize(this.changeFontSize + StyleConstants.UNIT_FP)Column() {Row() {ForEach(this.sliderTitle, (item: string, i: number) => {Text(item).fontSize(i === 3 ? 16 : 13)})}.width('91%').justifyContent(FlexAlign.SpaceBetween)Stack() {Row() {ForEach([1, 2, 3, 4], (item: number) => {Text().width(2).height(12).backgroundColor('#646464')})}.width(this.lineW).justifyContent(FlexAlign.SpaceBetween)Stack() {Line().width(this.lineW).height(2).backgroundColor('#646464')Text().width(this.circleW).height(this.circleH).borderRadius(9).backgroundColor(Color.White).border({ width: 3, color: "#646464" }).draggable(true).translate({ x: this.callbackOffset() })}.width('97%').height(50).alignContent(Alignment.Start).onTouch(async (event) => {this.offsetX = event.touches[0].xif (event.touches[0].x < this.circleW) {this.offsetX = this.circleW}if (event.touches[0].x > this.lineW) {this.offsetX = this.lineW}if (this.offsetX > CommonConstants.SET_SCALE_SMALL_VERTICAL &&this.offsetX <=CommonConstants.SET_SCALE_NORMAL_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL) {this.changeFontSize = CommonConstants.SET_SIZE_SMALL} else if (this.offsetX >CommonConstants.SET_SCALE_NORMAL_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL / 2 &&this.offsetX <= CommonConstants.SET_SCALE_LARGE_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL) {this.changeFontSize = CommonConstants.SET_SIZE_NORMAL} else if (this.offsetX >CommonConstants.SET_SCALE_LARGE_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL &&this.offsetX <=CommonConstants.SET_SCALE_EXTRA_LARGE_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL) {this.changeFontSize = CommonConstants.SET_SIZE_LARGE} else if (this.offsetX >CommonConstants.SET_SCALE_EXTRA_LARGE_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL &&this.offsetX <= CommonConstants.SET_SCALE_EXTRA_LARGE_VERTICAL) {this.changeFontSize = CommonConstants.SET_SIZE_EXTRA_LARGE}// this.changeFontSize_Vertical()if (event.type === TouchType.Up) {if (event.touches[0].x > CommonConstants.SET_SCALE_SMALL_VERTICAL && event.touches[0].x <CommonConstants.SET_SCALE_NORMAL_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL) {this.offsetX = CommonConstants.SET_SCALE_SMALL_VERTICAL}if (event.touches[0].x >CommonConstants.SET_SCALE_NORMAL_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL &&event.touches[0].x <CommonConstants.SET_SCALE_LARGE_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL) {this.offsetX = CommonConstants.SET_SCALE_NORMAL_VERTICAL}if (event.touches[0].x >CommonConstants.SET_SCALE_LARGE_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL &&event.touches[0].x <CommonConstants.SET_SCALE_EXTRA_LARGE_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL) {this.offsetX = CommonConstants.SET_SCALE_LARGE_VERTICAL}if (event.touches[0].x >CommonConstants.SET_SCALE_EXTRA_LARGE_VERTICAL - CommonConstants.SET_SCALE_AVERAGE_VERTICAL &&event.touches[0].x < CommonConstants.SET_SCALE_EXTRA_LARGE_VERTICAL) {this.offsetX = CommonConstants.SET_SCALE_EXTRA_LARGE_VERTICAL}}if (this.changeFontSize === 0) {this.changeFontSize = await PreferencesUtil.getChangeFontSize();return;}})}.width('93%')}.width('100%').height(48).margin({ bottom: 40, top: 5 })}.height('100%').width('100%')}
}

utils_GlobalContext:

/** Copyright (c) 2023 Huawei Device Co., Ltd.* Licensed under the Apache License,Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at** http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/export class GlobalContext {private constructor() { }private static instance: GlobalContext;private _objects = new Map<string, Object>();public static getContext(): GlobalContext {if (!GlobalContext.instance) {GlobalContext.instance = new GlobalContext();}return GlobalContext.instance;}getObject(value: string): Object | undefined {return this._objects.get(value);}setObject(key: string, objectClass: Object): void {this._objects.set(key, objectClass);}
}

utils_CommonConstants:

/** Copyright (c) 2022 Huawei Device Co., Ltd.* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at**     http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*//*** Common constants for all features.*/
export default class CommonConstants {// fontSizestatic readonly SET_SIZE_SMALL: number = 13.6;static readonly SET_SIZE_NORMAL: number = 16;static readonly SET_SIZE_LARGE: number = 18.4;static readonly SET_SIZE_EXTRA_LARGE: number = 20.8;//   scale_pad_verticalstatic readonly SET_SCALE_SMALL_VERTICAL: number = 0static readonly SET_SCALE_NORMAL_VERTICAL: number = 214static readonly SET_SCALE_LARGE_VERTICAL: number = 428static readonly SET_SCALE_EXTRA_LARGE_VERTICAL: number = 642static readonly SET_SCALE_AVERAGE_VERTICAL: number = 107//   scale_pad_acrossstatic readonly SET_SCALE_SMALL_ACROSS: number = 0static readonly SET_SCALE_NORMAL_ACROSS: number = 342static readonly SET_SCALE_LARGE_ACROSS: number = 684static readonly SET_SCALE_EXTRA_LARGE_ACROSS: number = 1026static readonly SET_SCALE_AVERAGE_ACROSS: number = 171
}

utils_PreferencesUtil:

/** Copyright (c) 2022 Huawei Device Co., Ltd.* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at**     http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/import { preferences } from '@kit.ArkData';
import { GlobalContext } from './GlobalContext';const TAG = '[PreferencesUtil]';
const PREFERENCES_NAME = 'myPreferences';
const KEY_APP_FONT_SIZE = 'appFontSize';/*** The PreferencesUtil provides preferences of create, save and query.*/
export class PreferencesUtil {createFontPreferences(context: Context) {let fontPreferences: Function = (() => {let preference: Promise<preferences.Preferences> = preferences.getPreferences(context, PREFERENCES_NAME);return preference;});GlobalContext.getContext().setObject('getFontPreferences', fontPreferences);}saveDefaultFontSize(fontSize: number) {let getFontPreferences: Function = GlobalContext.getContext().getObject('getFontPreferences') as Function;getFontPreferences().then((preferences: preferences.Preferences) => {preferences.has(KEY_APP_FONT_SIZE).then(async (isExist: boolean) => {if (!isExist) {await preferences.put(KEY_APP_FONT_SIZE, fontSize);preferences.flush();}}).catch((err: Error) => {});}).catch((err: Error) => {});}saveChangeFontSize(fontSize: number) {let getFontPreferences: Function = GlobalContext.getContext().getObject('getFontPreferences') as Function;getFontPreferences().then(async (preferences: preferences.Preferences) => {await preferences.put(KEY_APP_FONT_SIZE, fontSize);preferences.flush();}).catch((err: Error) => {});}async getChangeFontSize() {let fontSize: number = 0;let getFontPreferences: Function = GlobalContext.getContext().getObject('getFontPreferences') as Function;// const preferences: dataPreferences.Preferences = await getFontPreferences();fontSize = await (await getFontPreferences()).get(KEY_APP_FONT_SIZE, fontSize);return fontSize;}async deleteChangeFontSize() {let getFontPreferences: Function = GlobalContext.getContext().getObject('getFontPreferences') as Function;const preferences: preferences.Preferences = await getFontPreferences();let deleteValue = preferences.delete(KEY_APP_FONT_SIZE);deleteValue.then(() => {}).catch((err: Error) => {});}
}export default new PreferencesUtil();

utils_StyleConstants:

/** Copyright (c) 2022 Huawei Device Co., Ltd.* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at**     http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*//*** Style constants for all features.*/
export default class StyleConstants {/*** The head aspect ratio.*/static readonly HEAD_ASPECT_RATIO: number = 1;/*** Weight to fill.*/static readonly WEIGHT_FULL: number = 1;/*** Minimum height of two lines of text.*/static readonly DOUBLE_ROW_MIN: number = 28;/*** Unit of fp.*/static readonly UNIT_FP: string = 'fp';/*** Full the width.*/static readonly FULL_WIDTH: string = '100%';/*** Full the height.*/static readonly FULL_HEIGHT: string = '100%';/*** The percentage of 7.2.*/static readonly TITLE_BAR_HEIGHT_PERCENT: string = '7.2%';/*** The percentage of 93.3.*/static readonly BLOCK_WIDTH_PERCENT: string = '93.3%';/*** The percentage of 0.5.*/static readonly BLOCK_TOP_MARGIN_FIRST_PERCENT: string = '0.5%';/*** The percentage of 1.5.*/static readonly BLOCK_TOP_MARGIN_SECOND_PERCENT: string = '1.5%';/*** The percentage of 23.8.*/static readonly DIVIDER_END_MARGIN_PERCENT: string = '23.8%';/*** The percentage of 6.7.*/static readonly HEAD_RIGHT_PERCENT: string = '6.7%';/*** The percentage of 2.2.*/static readonly HEAD_LEFT_PERCENT: string = '2.2%';/*** The percentage of 64.4.*/static readonly MAX_CHAT_WIDTH_PERCENT: string = '64.4%';/*** The percentage of 3.1.*/static readonly CHAT_TOP_MARGIN_PERCENT: string = '3.1%';/*** The percentage of 6.5.*/static readonly SLIDER_LAYOUT_LEFT_PERCENT: string = '6.5%';/*** The percentage of 3.2.*/static readonly SLIDER_LAYOUT_TOP_PERCENT: string = '3.2%';/*** The percentage of 8.9.*/static readonly SET_CHAT_HEAD_SIZE_PERCENT: string = '8.9%';/*** The percentage of 12.5.*/static readonly A_WIDTH_PERCENT: string = '12.5%';/*** The percentage of 75.*/static readonly SLIDER_WIDTH_PERCENT: string = '75%';/*** The percentage of 3.3.*/static readonly SLIDER_HORIZONTAL_MARGIN_PERCENT: string = '3.3%';/*** The percentage of 1.*/static readonly SLIDER_TOP_MARGIN_PERCENT: string = '1%';/*** The percentage of 6.2.*/static readonly SLIDER_BOTTOM_MARGIN_PERCENT: string = '6.2%';
}

相关文章:

鸿蒙中自定义slider实现字体大小变化

ui&#xff1a; import { display, mediaquery, router } from kit.ArkUI import CommonConstants from ./CommonConstants; import PreferencesUtil from ./PreferencesUtil; import StyleConstants from ./StyleConstants;// 字体大小 Entry Component struct FontSize {Sta…...

数据结构与算法之栈: LeetCode 71. 简化路径 (Ts版)

简化路径 https://leetcode.cn/problems/simplify-path/description/ 描述 给你一个字符串 path &#xff0c;表示指向某一文件或目录的 Unix 风格 绝对路径 &#xff08;以 ‘/’ 开头&#xff09;&#xff0c;请你将其转化为 更加简洁的规范路径 在 Unix 风格的文件系统中…...

STM32-笔记40-BKP(备份寄存器)

一、什么是BKP&#xff08;备份寄存器&#xff09;&#xff1f; 备份寄存器是42个16位的寄存器&#xff0c;可用来存储84个字节的用户应用程序数据。他们处在备份域里&#xff0c;当VDD电源被切断&#xff0c;他们仍然由VBAT维持供电。当系统在待机模式下被唤醒&#xff0c;或…...

NAS中不同RAID级别特点与适用场景

1. RAID 0&#xff08;条带化&#xff09; 硬盘数量&#xff1a;至少2块。硬盘要求&#xff1a;硬盘容量可以不同&#xff0c;但总容量以最小硬盘为准&#xff08;例如&#xff1a;1TB 2TB 2TB&#xff0c;其中1TB会被浪费&#xff09;。优点&#xff1a; 读写性能显著提升&…...

node.js的进程保活

nodejs的进程保活其实用PM2应该更好用些&#xff0c;不过由于原理其实并不复杂&#xff0c;我们可以自己手写一个服务来干这个工作。 假设我们有一个服务&#xff0c;可以这样来定义下它的相关信息&#xff1a; const svcs[ {"sid":"apl","name"…...

meta name=“viewport“ content=“width=device-width, initial-scale=1.0“

meta name“viewport” content“widthdevice-width, initial-scale1.0” 这段代码在网页设计中扮演着非常重要的角色&#xff0c;尤其是在响应式设计中。下面是对这段代码的详细解释及其在响应式设计中的作用&#xff1a; 1. 代码含义 html Copy Code meta 标签是 HTML 中用…...

【vue3】 defineExpose 的使用

以下是 Vue3 中defineExpose的使用方法&#xff1a; 基本概念 defineExpose是 Vue3 中的一个工具函数&#xff0c;是仅能在<script setup>中使用的函数&#xff0c;用于显式暴露组件内部的属性或方法给父组件使用2。在 Vue3 的<script setup>中&#xff0c;组件的…...

思维转换:突破思维桎梏,创造更高效的工作与生活

在现代职场和生活中&#xff0c;我们经常面临着各种挑战和问题&#xff0c;有时候虽然付出了很多努力&#xff0c;但依然难以找到更有效的解决方案。这时&#xff0c;或许我们需要的不是更多的努力&#xff0c;而是一次“思维转换”。这一概念看似简单&#xff0c;但它背后却蕴…...

OpenCV相机标定与3D重建(55)通用解决 PnP 问题函数solvePnPGeneric()的使用

操作系统&#xff1a;ubuntu22.04 OpenCV版本&#xff1a;OpenCV4.9 IDE:Visual Studio Code 编程语言&#xff1a;C11 算法描述 根据3D-2D点对应关系找到物体的姿态。 cv::solvePnPGeneric 是 OpenCV 中一个更为通用的函数&#xff0c;用于解决 PnP 问题。它能够返回多个可能…...

vue3学习日记5 - 项目起步

最近发现职场前端用的框架大多为vue&#xff0c;所以最近也跟着黑马程序员vue3的课程进行学习&#xff0c;以下是我的学习记录 视频网址&#xff1a; Day2-11.项目起步-静态资源引入和ErrorLen安装_哔哩哔哩_bilibili 学习日记&#xff1a; vue3学习日记1 - 环境搭建-CSDN博…...

java导出pdf文件

java导出pdf&#xff0c;前端下载 1、制作pdf模板2、获取pdf导出中文需要的文件3、实现4、前端发起请求并生成下载链接 使用注意点 因为原来制作的pdf表单内容过于复杂&#xff0c;下面代码只包含前两行的操作。 本次操作需要前端向后端发起请求&#xff0c;后端返回数据给前端…...

【MySQL学习笔记】MySQL视图View

视图View 1、视图的基础语法2、检查选项3、视图的更新4、视图的作用 视图&#xff08;View&#xff09;是一种虚拟存在的表。视图中的数据并不在数据库中实际存在&#xff0c;行和列数据来自定义视图的查询中使用的表&#xff0c;并且是在使用视图时动态生成的。 通俗的讲&…...

从玩具到工业控制--51单片机的跨界传奇【2】

咱们在上一篇博客里面讲解了什么是单片机《单片机入门》&#xff0c;让大家对单片机有了初步的了解。我们今天继续讲解一些有关单片机的知识&#xff0c;顺便也讲解一下我们单片机用到的C语言知识。如果你对C语言还不太了解的话&#xff0c;可以看看博主的C语言专栏哟&#xff…...

【Redis】初识Redis

目录 Redis简介 Redis在内存中存储数据 Redis数据库中的应用 Redis缓存中的应用 Redis消息中间件 尾言 Redis简介 如下是Redis官网中&#xff0c;对Redis的一段描述 在这段描述中&#xff0c;我们提取如下关键要点&#xff1a; Redis主要用于在内存中存储数据Redis可…...

docker虚拟机平台未启用问题

在终端中输入如下代码&#xff0c;重启电脑即可 Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform 对于Docker Desktop - Unexpected WSL error问题 参考链接 解决WSL2与docker冲突问题...

《零基础Go语言算法实战》【题目 2-22】Go 调度器优先调度问题

《零基础Go语言算法实战》 【题目 2-22】Go 调度器优先调度问题 下面代码的输出是什么&#xff1f;请说明原因。 package main import ( "fmt" "runtime" "sync" ) func main() { runtime.GOMAXPROCS(1) wg : sync.WaitGroup{} wg.Add(10)…...

关于使用FastGPT 摸索的QA

近期在通过fastGPT&#xff0c;创建一些基于特定业务场景的、相对复杂的Agent智能体应用。 工作流在AI模型的基础上&#xff0c;可以定义业务逻辑&#xff0c;满足输出对话之外的需求。 在最近3个月来的摸索和实践中&#xff0c;一些基于经验的小问题点&#xff08;自己也常常…...

关于H5复制ios没有效果

问题场景&#xff1a;今天遇到这样一个问题&#xff0c;需要从后端接口获取到的值进行复制&#xff0c;且不能提现调用获取值&#xff0c;因为是一个数据列表&#xff0c;每个列表元素需要当场点击调用接口获取值进行复制&#xff0c;本来以为很简单的一个需求&#xff0c;当做…...

【STM32-学习笔记-3-】TIM定时器

文章目录 TIM定时器Ⅰ、TIM定时器函数Ⅱ、TIM_TimeBaseInitTypeDef结构体参数①、TIM_ClockDivision②、TIM_CounterMode③、TIM_Period④、TIM_Prescaler⑤、TIM_RepetitionCounter Ⅱ、定时器配置Ⅲ、定时器外部中断NVIC配置 TIM定时器 Ⅰ、TIM定时器函数 // 将定时器寄存器…...

EMS专题 | 守护数据安全:数据中心和服务器机房环境温湿度监测

您需要服务器机房温度监测解决方案吗&#xff1f; 服务器机房是企业中用于存储、管理和维护服务器及其相关组件的设施。服务器机房通常位于数据中心内&#xff0c;是一个专门设计的物理环境&#xff0c;旨在确保服务器的稳定运行和数据的安全性。服务器机房主要起到存储和管理数…...

医疗AI实战:如何用NLP技术从电子病历中提取科研特征(附Python代码)

医疗AI实战&#xff1a;从电子病历中挖掘科研金矿的NLP技术指南 在医疗健康领域&#xff0c;电子病历&#xff08;EMR&#xff09;是一座尚未充分开发的数据金矿。据统计&#xff0c;医疗机构产生的数据中超过70%是非结构化文本信息&#xff0c;包括医生记录、检查报告和病程描…...

Matlab vs Python:灰色关联分析(GRA)可视化效果大比拼

Matlab vs Python&#xff1a;灰色关联分析可视化效果与实现深度对比 在数据科学领域&#xff0c;灰色关联分析(Grey Relational Analysis, GRA)作为一种强大的小样本数据分析工具&#xff0c;正逐渐受到研究者和实践者的青睐。面对两种主流编程语言Matlab和Python&#xff0c;…...

告别卡顿!用EnhancedScroller优化Unity UI长列表的完整避坑指南

告别卡顿&#xff01;用EnhancedScroller优化Unity UI长列表的完整避坑指南 在Unity开发中&#xff0c;处理大量数据的UI列表是常见的需求&#xff0c;但原生ScrollRect在面对成千上万条数据时往往力不从心。想象一下&#xff0c;当用户滑动一个包含数百个好友的社交列表时&am…...

腾讯云端Openclaw+飞书 多机器人配置全攻略(新手友好版)

前言&#xff1a;随着AI自动化工具的普及&#xff0c;Openclaw凭借强大的自主执行能力&#xff0c;成为很多人提升效率的首选&#xff1b;而飞书作为高效协同工具&#xff0c;其机器人功能可无缝融入日常工作流。当两者结合&#xff0c;配置多机器人实现分工协作&#xff08;如…...

数据结构与算法学习笔记

java一.数据结构简介1. 为什么要有数据结构&#xff1f;数据太多、太乱 → 无法高效处理 → 必须结构化2. 数据结构的两大分类逻辑结构&#xff1a;数据之间的关系&#xff08;怎么理解&#xff09;物理结构&#xff1a;内存中的存储方式&#xff08;怎么实现&#xff09;3. 逻…...

WarcraftHelper技术适配方案:让经典RTS游戏重获现代硬件支持

WarcraftHelper技术适配方案&#xff1a;让经典RTS游戏重获现代硬件支持 【免费下载链接】WarcraftHelper Warcraft III Helper , support 1.20e, 1.24e, 1.26a, 1.27a, 1.27b 项目地址: https://gitcode.com/gh_mirrors/wa/WarcraftHelper 痛点解析&#xff1a;魔兽争霸…...

别再纠结FP32了!手把手教你用PyTorch的BF16和FP16加速大模型训练(附完整代码)

突破显存瓶颈&#xff1a;PyTorch混合精度训练实战指南 当你在深夜盯着屏幕上那个"CUDA out of memory"的错误提示时&#xff0c;是否感到一阵无力&#xff1f;大模型训练就像是在走钢丝——一边是宝贵的显存资源&#xff0c;另一边是模型性能的悬崖。作为一名经历过…...

Attu可视化工具:向量数据库性能监控与运维效率提升实践

Attu可视化工具&#xff1a;向量数据库性能监控与运维效率提升实践 【免费下载链接】attu The Best GUI for Milvus 项目地址: https://gitcode.com/gh_mirrors/at/attu Attu作为Milvus向量数据库的图形化管理界面&#xff0c;通过系统监控工具、性能分析仪表盘和可视化…...

ERNIE-4.5-0.3B-PT创意写作实战:用AI帮你生成有画面感的场景描述

ERNIE-4.5-0.3B-PT创意写作实战&#xff1a;用AI帮你生成有画面感的场景描述 1. 为什么需要AI辅助创意写作 在内容创作领域&#xff0c;最令人头疼的莫过于如何让文字"活起来"。传统写作往往面临三大痛点&#xff1a; 画面感不足&#xff1a;描述停留在表面&#…...

5步搞定Jimeng LoRA测试台:Streamlit界面,LoRA版本智能排序

5步搞定Jimeng LoRA测试台&#xff1a;Streamlit界面&#xff0c;LoRA版本智能排序 1. 项目概述&#xff1a;轻量级LoRA测试系统 Jimeng LoRA测试台是一款专为模型开发者设计的轻量化文本生成图像系统。它基于Z-Image-Turbo文生图底座&#xff0c;实现了动态多版本LoRA热切换…...