Vue3 实现pdf预览
1.使用到的插件 vue3-pdf-app 以及预览效果
2.下载依赖
// 可以使用npm 以及pnpm
// 下载版本1.0.3
pnpm install vue3-pdf-app@^1.0.3
3.封装pdfModel组件复用
<template><VuePdfApp :page-scale="pageScale" :theme="theme" :style="`width: ${viewerWidth}; height: ${viewerHeight};`":pdf="src" :fileName="fileName" @pages-rendered="pagesRendered" v-bind="$attrs" :config="config"></VuePdfApp>
</template><script setup lang="ts">
import { computed, ref } from 'vue'
import VuePdfApp from 'vue3-pdf-app'
import 'vue3-pdf-app/dist/icons/main.css'
// 工具栏配置项
const config = ref({// 右侧其他区工具sidebar: {viewThumbnail: true,//启用缩略图视图viewOutline: true,//启用大纲视图viewAttachments: false,//启用附件视图},secondaryToolbar: {secondaryPresentationMode: true,//启用演示模式secondaryOpenFile: true, //启用打开文件功能secondaryPrint: true,//启用打印功能secondaryDownload: true,//启用下载功能secondaryViewBookmark: true,//启用书签视图firstPage: false,//启用跳转到第一页lastPage: false,//启用跳转到最后一页pageRotateCw: true,//启用顺时针旋转页面pageRotateCcw: true,//启用逆时针旋转页面cursorSelectTool: false,//启用选择工具cursorHandTool: false,//启用手形工具scrollVertical: false,//启用垂直滚动scrollHorizontal: false,//启用水平滚动scrollWrapped: false,//启用包裹滚动spreadNone: false,//启用无跨页模式spreadOdd: false,// 启用奇数页跨页模式spreadEven: false,//启用偶数页跨页模式documentProperties: false,//启用文档属性查看},// 配置左侧工具栏toolbar: {toolbarViewerLeft: {findbar: false,//启用查找条previous: true,// 启用上一页按钮next: true,//启用下一页按钮pageNumber: true,// 启用页码显示},// 配置右侧工具栏toolbarViewerRight: {presentationMode: false,//启用演示模式openFile: false,//启用打开文件功能print: false,//启用打印功能download: false,// 启用下载功能viewBookmark: false,// 启用书签视图},// 配置中间工具栏toolbarViewerMiddle: {zoomOut: true,// 启用缩小功能zoomIn: true,//启用放大功能。scaleSelectContainer: false,//启用缩放选择容器功能},},//启用错误包装,这可能用于显示错误信息或处理错误情况。errorWrapper: true,
})interface Props {src: string | ArrayBuffer // pdf地址width?: string | number // 预览容器宽度height?: string | number // 预览容器高度pageScale?: number | string // 页面默认缩放规则,可选 'page-actual'|'page-width'|'page-height'|'page-fit'|'auto'theme?: string // 预览主题 可选 dark | lightfileName?: string // 覆盖pdf文件名
}const props = withDefaults(defineProps<Props>(), {src: '',width: '100%',height: '100%',pageScale: 'page-fit', // 默认自适应展示一页theme: 'dark',fileName: ''
})
const viewerWidth = computed(() => {if (typeof props.width === 'number') {return props.width + 'px'} else {return props.width}
})
const viewerHeight = computed(() => {if (typeof props.height === 'number') {return props.height + 'px'} else {return props.height}
})
const emit = defineEmits(['loaded'])
function pagesRendered(pdfApp: any) {// console.log('pdfApp页码渲染完成:', pdfApp)emit('loaded', pdfApp)
}
</script><style lang="less" scoped>
@themeColor: #1677FF;:deep(*) {box-sizing: content-box;
}// 定制化主题色
.pdf-app.dark {--pdf-app-background-color: rgb(83, 86, 89, 0);--pdf-sidebar-content-color: rgb(51, 54, 57);--pdf-toolbar-sidebar-color: #24364e;--pdf-toolbar-color: rgb(50, 54, 57);--pdf-loading-bar-color: #606c88;--pdf-loading-bar-secondary-color: @themeColor;--pdf-find-results-count-color: #d9d9d9;--pdf-find-results-count-font-color: #525252;--pdf-find-message-font-color: #a6b7d0;--pdf-not-found-color: #f66;--pdf-split-toolbar-button-separator-color: #fff;--pdf-toolbar-font-color: #d9d9d9;--pdf-button-hover-font-color: @themeColor;--pdf-button-toggled-color: #606c88;--pdf-horizontal-toolbar-separator-color: #fff;--pdf-input-color: #606c88;--pdf-input-font-color: #d9d9d9;--pdf-find-input-placeholder-font-color: @themeColor;--pdf-thumbnail-selection-ring-color: hsla(0, 0%, 100%, .15);--pdf-thumbnail-selection-ring-selected-color: rgb(147, 179, 242);--pdf-error-wrapper-color: #f55;--pdf-error-more-info-color: #d9d9d9;--pdf-error-more-info-font-color: #000;--pdf-overlay-container-color: rgba(0, 0, 0, .2);--pdf-overlay-container-dialog-color: #24364e;--pdf-overlay-container-dialog-font-color: #d9d9d9;--pdf-overlay-container-dialog-separator-color: #fff;--pdf-dialog-button-font-color: #d9d9d9;--pdf-dialog-button-color: #606c88;:deep(.thumbnail.selected>.thumbnailSelectionRing) {background-color: rgb(147, 179, 242);}
}.pdf-app.light {--pdf-app-background-color: rgb(245, 245, 245);--pdf-sidebar-content-color: rgb(245, 245, 245);--pdf-toolbar-sidebar-color: rgb(190, 190, 190);--pdf-toolbar-color: rgb(225, 225, 225);--pdf-loading-bar-color: #3f4b5b;--pdf-loading-bar-secondary-color: #666;--pdf-find-results-count-color: #3f4b5b;--pdf-find-results-count-font-color: hsla(0, 0%, 100%, .87);--pdf-find-message-font-color: hsla(0, 0%, 100%, .87);--pdf-not-found-color: brown;--pdf-split-toolbar-button-separator-color: #000;--pdf-toolbar-font-color: rgb(142, 142, 142);--pdf-button-hover-font-color: #666;--pdf-button-toggled-color: #3f4b5b;--pdf-horizontal-toolbar-separator-color: #000;--pdf-input-color: #3f4b5b;--pdf-input-font-color: #d9d9d9;--pdf-find-input-placeholder-font-color: #666;--pdf-thumbnail-selection-ring-color: hsla(208, 7%, 46%, .7);--pdf-thumbnail-selection-ring-selected-color: #3f4b5b;--pdf-error-wrapper-color: #f55;--pdf-error-more-info-color: #d9d9d9;--pdf-error-more-info-font-color: #000;--pdf-overlay-container-color: hsla(208, 7%, 46%, .7);--pdf-overlay-container-dialog-color: #6c757d;--pdf-overlay-container-dialog-font-color: #d9d9d9;--pdf-overlay-container-dialog-separator-color: #000;--pdf-dialog-button-font-color: #d9d9d9;--pdf-dialog-button-color: #3f4b5b;:deep(.thumbnail.selected>.thumbnailSelectionRing) {background-color: rgb(105, 105, 105);}
}
</style>
4.页面使用(可以直接使用在线pdf链接 也可以上传pdf预览)
<template><div style="margin: 20px;"><input type="file" @change="handleChange" /></div><div class="pdfBox" v-if="pdfUrl !== ''"><PdfPreview page-scale="page-fit" :width="900" :height="600" theme="light" :src="pdfUrl" @loaded="onLoaded" /></div>
</template><script setup lang="ts">
import { ref } from 'vue';
import PdfPreview from './pdfModel.vue';// const pdfUrl = ref<any>('http://storage.xuetangx.com/public_assets/xuetangx/PDF/PlayerAPI_v1.0.6.pdf');
const pdfUrl = ref<any>('');
// 判断文件加载完成
const onLoaded = (pdfApp: any) => {console.log('文件加载完成');
};// 也可直接上传文件显示
let handleChange = (e: any) => {let files = e.target.files[0];let reader = new FileReader();reader.readAsArrayBuffer(files);reader.onload = function () {// docxSrc.value = reader.result;pdfUrl.value = reader.result;};
};
</script><style scoped lang="less">
.pdfBox {width: 900px;height: 600px;overflow: scroll;overflow-x: hidden;overflow-y: hidden;
}
</style>
5.设置中文
能看到在使用的时候操作栏全部都是英文
6.创建 viewer.properties文件与src同级
文件代码
# vue3-pdf-app插件转中文配置代码
# Copyright 2012 Mozilla Foundation
#
# 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.# Main toolbar buttons (tooltips and alt text for images)
previous.title=上一页
previous_label=上一页
next.title=下一页
next_label=下一页# LOCALIZATION NOTE (page.title): The tooltip for the pageNumber input.
page.title=页面
# LOCALIZATION NOTE (of_pages): "{{pagesCount}}" will be replaced by a number
# representing the total number of pages in the document.
of_pages=/ {{pagesCount}}
# LOCALIZATION NOTE (page_of_pages): "{{pageNumber}}" and "{{pagesCount}}"
# will be replaced by a number representing the currently visible page,
# respectively a number representing the total number of pages in the document.
page_of_pages=({{pageNumber}} / {{pagesCount}})zoom_out.title=缩小
zoom_out_label=缩小
zoom_in.title=放大
zoom_in_label=放大
zoom.title=缩放
presentation_mode.title=切换到演示模式
presentation_mode_label=演示模式
open_file.title=打开文件
open_file_label=打开
print.title=打印
print_label=打印
download.title=下载
download_label=下载
bookmark.title=当前在看的内容(复制或在新窗口中打开)
bookmark_label=当前在看save.title=保存
save_label=保存
bookmark1.title=当前页面(在当前页面查看 URL)
bookmark1_label=当前页面# Secondary toolbar and context menu
tools.title=工具
tools_label=工具
first_page.title=转到第一页
first_page_label=转到第一页
last_page.title=转到最后一页
last_page_label=转到最后一页
page_rotate_cw.title=顺时针旋转
page_rotate_cw_label=顺时针旋转
page_rotate_ccw.title=逆时针旋转
page_rotate_ccw_label=逆时针旋转cursor_text_select_tool.title=启用文本选择工具
cursor_text_select_tool_label=文本选择工具
cursor_hand_tool.title=启用手形工具
cursor_hand_tool_label=手形工具scroll_page.title=使用页面滚动
scroll_page_label=页面滚动
scroll_vertical.title=使用垂直滚动
scroll_vertical_label=垂直滚动
scroll_horizontal.title=使用水平滚动
scroll_horizontal_label=水平滚动
scroll_wrapped.title=使用平铺滚动
scroll_wrapped_label=平铺滚动spread_none.title=不加入衔接页
spread_none_label=单页视图
spread_odd.title=加入衔接页使奇数页作为起始页
spread_odd_label=双页视图
spread_even.title=加入衔接页使偶数页作为起始页
spread_even_label=书籍视图# Document properties dialog box
document_properties.title=文档属性…
document_properties_label=文档属性…
document_properties_file_name=文件名:
document_properties_file_size=文件大小:
# LOCALIZATION NOTE (document_properties_kb): "{{size_kb}}" and "{{size_b}}"
# will be replaced by the PDF file size in kilobytes, respectively in bytes.
document_properties_kb={{size_kb}} KB ({{size_b}} 字节)
# LOCALIZATION NOTE (document_properties_mb): "{{size_mb}}" and "{{size_b}}"
# will be replaced by the PDF file size in megabytes, respectively in bytes.
document_properties_mb={{size_mb}} MB ({{size_b}} 字节)
document_properties_title=标题:
document_properties_author=作者:
document_properties_subject=主题:
document_properties_keywords=关键词:
document_properties_creation_date=创建日期:
document_properties_modification_date=修改日期:
# LOCALIZATION NOTE (document_properties_date_string): "{{date}}" and "{{time}}"
# will be replaced by the creation/modification date, and time, of the PDF file.
document_properties_date_string={{date}}, {{time}}
document_properties_creator=创建者:
document_properties_producer=PDF 生成器:
document_properties_version=PDF 版本:
document_properties_page_count=页数:
document_properties_page_size=页面大小:
document_properties_page_size_unit_inches=英寸
document_properties_page_size_unit_millimeters=毫米
document_properties_page_size_orientation_portrait=纵向
document_properties_page_size_orientation_landscape=横向
document_properties_page_size_name_a3=A3
document_properties_page_size_name_a4=A4
document_properties_page_size_name_letter=文本
document_properties_page_size_name_legal=法律
# LOCALIZATION NOTE (document_properties_page_size_dimension_string):
# "{{width}}", "{{height}}", {{unit}}, and {{orientation}} will be replaced by
# the size, respectively their unit of measurement and orientation, of the (current) page.
document_properties_page_size_dimension_string={{width}} × {{height}} {{unit}}({{orientation}})
# LOCALIZATION NOTE (document_properties_page_size_dimension_name_string):
# "{{width}}", "{{height}}", {{unit}}, {{name}}, and {{orientation}} will be replaced by
# the size, respectively their unit of measurement, name, and orientation, of the (current) page.
document_properties_page_size_dimension_name_string={{width}} × {{height}} {{unit}}({{name}},{{orientation}})
# LOCALIZATION NOTE (document_properties_linearized): The linearization status of
# the document; usually called "Fast Web View" in English locales of Adobe software.
document_properties_linearized=快速 Web 视图:
document_properties_linearized_yes=是
document_properties_linearized_no=否
document_properties_close=关闭print_progress_message=正在准备打印文档…
# LOCALIZATION NOTE (print_progress_percent): "{{progress}}" will be replaced by
# a numerical per cent value.
print_progress_percent={{progress}}%
print_progress_close=取消# Tooltips and alt text for side panel toolbar buttons
# (the _label strings are alt text for the buttons, the .title strings are
# tooltips)
toggle_sidebar.title=切换侧栏
toggle_sidebar_notification2.title=切换侧栏(文档所含的大纲/附件/图层)
toggle_sidebar_label=切换侧栏
document_outline.title=显示文档大纲(双击展开/折叠所有项)
document_outline_label=文档大纲
attachments.title=显示附件
attachments_label=附件
layers.title=显示图层(双击即可将所有图层重置为默认状态)
layers_label=图层
thumbs.title=显示缩略图
thumbs_label=缩略图
current_outline_item.title=查找当前大纲项目
current_outline_item_label=当前大纲项目
findbar.title=在文档中查找
findbar_label=查找additional_layers=其他图层
# LOCALIZATION NOTE (page_landmark): "{{page}}" will be replaced by the page number.
page_landmark=第 {{page}} 页
# Thumbnails panel item (tooltip and alt text for images)
# LOCALIZATION NOTE (thumb_page_title): "{{page}}" will be replaced by the page
# number.
thumb_page_title=第 {{page}} 页
# LOCALIZATION NOTE (thumb_page_canvas): "{{page}}" will be replaced by the page
# number.
thumb_page_canvas=页面 {{page}} 的缩略图# Find panel button title and messages
find_input.title=查找
find_input.placeholder=在文档中查找…
find_previous.title=查找词语上一次出现的位置
find_previous_label=上一页
find_next.title=查找词语后一次出现的位置
find_next_label=下一页
find_highlight=全部高亮显示
find_match_case_label=区分大小写
find_match_diacritics_label=匹配变音符号
find_entire_word_label=全词匹配
find_reached_top=到达文档开头,从末尾继续
find_reached_bottom=到达文档末尾,从开头继续
# LOCALIZATION NOTE (find_match_count): The supported plural forms are
# [one|two|few|many|other], with [other] as the default value.
# "{{current}}" and "{{total}}" will be replaced by a number representing the
# index of the currently active find result, respectively a number representing
# the total number of matches in the document.
find_match_count={[ plural(total) ]}
find_match_count[one]=第 {{current}} 项,共匹配 {{total}} 项
find_match_count[two]=第 {{current}} 项,共匹配 {{total}} 项
find_match_count[few]=第 {{current}} 项,共匹配 {{total}} 项
find_match_count[many]=第 {{current}} 项,共匹配 {{total}} 项
find_match_count[other]=第 {{current}} 项,共匹配 {{total}} 项
# LOCALIZATION NOTE (find_match_count_limit): The supported plural forms are
# [zero|one|two|few|many|other], with [other] as the default value.
# "{{limit}}" will be replaced by a numerical value.
find_match_count_limit={[ plural(limit) ]}
find_match_count_limit[zero]=超过 {{limit}} 项匹配
find_match_count_limit[one]=超过 {{limit}} 项匹配
find_match_count_limit[two]=超过 {{limit}} 项匹配
find_match_count_limit[few]=超过 {{limit}} 项匹配
find_match_count_limit[many]=超过 {{limit}} 项匹配
find_match_count_limit[other]=超过 {{limit}} 项匹配
find_not_found=找不到指定词语# Error panel labels
error_more_info=更多信息
error_less_info=更少信息
error_close=关闭
# LOCALIZATION NOTE (error_version_info): "{{version}}" and "{{build}}" will be
# replaced by the PDF.JS version and build ID.
error_version_info=PDF.js v{{version}} (build: {{build}})
# LOCALIZATION NOTE (error_message): "{{message}}" will be replaced by an
# english string describing the error.
error_message=信息:{{message}}
# LOCALIZATION NOTE (error_stack): "{{stack}}" will be replaced with a stack
# trace.
error_stack=堆栈:{{stack}}
# LOCALIZATION NOTE (error_file): "{{file}}" will be replaced with a filename
error_file=文件:{{file}}
# LOCALIZATION NOTE (error_line): "{{line}}" will be replaced with a line number
error_line=行号:{{line}}# Predefined zoom values
page_scale_width=适合页宽
page_scale_fit=适合页面
page_scale_auto=自动缩放
page_scale_actual=实际大小
# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a
# numerical scale value.
page_scale_percent={{scale}}%# Loading indicator messages
loading=正在加载…# Loading indicator messages
loading_error=加载 PDF 时发生错误。
invalid_file_error=无效或损坏的 PDF 文件。
missing_file_error=缺少 PDF 文件。
unexpected_response_error=意外的服务器响应。rendering_error=渲染页面时发生错误。# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be
# replaced by the modification date, and time, of the annotation.
annotation_date_string={{date}},{{time}}# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.
# "{{type}}" will be replaced with an annotation type from a list defined in
# the PDF spec (32000-1:2008 Table 169 – Annotation types).
# Some common types are e.g.: "Check", "Text", "Comment", "Note"
text_annotation_type.alt=[{{type}} 注释]
password_label=输入密码以打开此 PDF 文件。
password_invalid=密码无效。请重试。
password_ok=确定
password_cancel=取消printing_not_supported=警告:此浏览器尚未完整支持打印功能。
printing_not_ready=警告:此 PDF 未完成加载,无法打印。
web_fonts_disabled=Web 字体已被禁用:无法使用嵌入的 PDF 字体。# Editor
editor_free_text2.title=文本
editor_free_text2_label=文本
editor_ink2.title=绘图
editor_ink2_label=绘图free_text2_default_content=开始输入…# Editor Parameters
editor_free_text_color=颜色
editor_free_text_size=字号
editor_ink_color=颜色
editor_ink_thickness=粗细
editor_ink_opacity=不透明度# Editor aria
editor_free_text2_aria_label=文本编辑器
editor_ink2_aria_label=绘图编辑器
editor_ink_canvas_aria_label=用户创建图像
7.在index.html引入当前文件
// index.html在src文件同级
<link rel="resource" type="application/l10n" href="./viewer.properties">
最终效果
当前文章引荐以下博主
KT553
相关文章:
Vue3 实现pdf预览
1.使用到的插件 vue3-pdf-app 以及预览效果 2.下载依赖 // 可以使用npm 以及pnpm // 下载版本1.0.3 pnpm install vue3-pdf-app^1.0.3 3.封装pdfModel组件复用 <template><VuePdfApp :page-scale"pageScale" :theme"theme" :style"width: …...
python网络爬虫开发实战之网页数据的解析提取
目录 1 XPath的使用 1.1 XPath概览 1.2 XPath常用规则 1.3 准备工作 1.4 实例引入 1.5 所有节点 1.6 节点 1.7 父节点 1.8 属性匹配 1.9 文本获取 1.10 属性获取 1.11 属性多值匹配 1.12 多属性匹配 1.13 按序选择 1.14 节点轴选择 2 Beautiful Soup 2.1 简介…...
GitHub Copilot平替:CodeGeeX 2.0实测报告
本文基于20个真实开发场景对CodeGeeX 2.0进行深度评测,涵盖代码生成质量、上下文理解能力、多语言支持度等关键维度。通过Python数据分析、Java微服务、React前端开发三大核心场景的对比实验,揭示其相比GitHub Copilot在中文语境支持、本地化部署、隐私保…...
QT对象模型
信号,槽,函数执行顺序 首先,拖入一个按钮,在转到槽,在click() 转到widget.cpp 在widget.h中 然后在widget.cpp中 运行结果 当发出信号后,先执行槽函数,再执行信号后面的函数(单线程) 在widget.h…...
C++:类型推导规则 unsigned short + 1
在 C/C 中,整数提升(Integer Promotion) 规则决定了 vlan_id 1 的类型: unsigned short 的值在运算时会被 提升(promote) 到 int 或 unsigned int(取决于平台)。 默认情况下&#x…...
PHP接口开发:从基础到高级的全面指南
一、接口基础与核心概念(约800字) 1.1 接口的本质定义 在PHP中,接口(Interface)是一种特殊的抽象结构,它通过interface关键字定义一组方法的契约规范,不包含具体实现。这种设计强制实现类必须遵循统一的调用标准,如: interface PaymentGateway {public function proc…...
C#Dictionary值拷贝还是引用
Dictionary值拷贝还是引用 这可能算是Directionary的一个坑值类型(Value Type)引用类型(Reference Type)总结 关于锁1. **锁对象的可见性**2. **锁对象的唯一性**3. **最佳实践**4. **为什么 readonly 是一个好的选择**5. **总结*…...
deepseek实战教程-第六篇查找源码之仓库地址与deepseek-R1、deepseek-LLM仓库内容查看
上一篇讲了支持deepseek的模型应用的本地安装和部署以及使用。再上一篇讲解了deepseek提供的开放api,便于开发者基于deepseek提供的接口来编写属于自己的业务应用程序。但是前面几篇我们都是在用模型,我们知道deepseek是开源的,那么deepseek的源码在哪里,具体源码是什么样的…...
WELL健康建筑认证是什么?
**WELL健康建筑认证:全方位呵护居住者福祉的权威标准** WELL健康建筑认证,这一源自美国的全球性健康建筑标准,宛如建筑界的璀璨明珠,以其独特的光芒照亮了健康建筑的发展之路。它不仅是全球首部专门针对室内环境提升人体健康与福…...
C++ STL 序列式容器之(三)-- List
一、什么是list? Lists are sequence containers that allow constant time insert and erase operations anywhere within the sequence, and iteration in both directions. 列表是序列容器,允许在序列中的任何位置进行以常量时间插入和擦除操作&…...
CAN基础知识学习二
一、控制器局域网总线(CAN,Controller Area Network); 二、CAN FD 是CAN with Flexible Data rate的缩写,翻译为【可变速率的 CAN】 CAN-FD 采用了两种位速率:从控制场中的 BRS 位到 ACK 场之前(…...
Java编程思想:为何有时要将子类对象赋值给父类引用
为何有时要将子类对象赋值给父类引用,用父类来进行实例化? 这就要说多态的优势: 代码的扩展性和降低耦合度,而不是完全避免修改代码。 TuXing t new Changfangxing(); Changfangxing k (Changfangxing)t;原因1: 代码可拓展性 …...
2025年优化算法:龙卷风优化算法(Tornado optimizer with Coriolis force,TOC)
龙卷风优化算法(Tornado optimizer with Coriolis force)是发表在中科院二区期刊“ARTIFICIAL INTELLIGENCE REVIEW”(IF:11.7)的2025年智能优化算法 01.引言 当自然界的狂暴之力,化身数字世界的智慧引擎&…...
2小样本学习(Few-Shot)之相似度
目录 小样本学习的基本思路: 具体实现方法: 小样本学习的基本思路: 学习一个相似度函数similarity function:sim(x,x) 两个样本越相近,相似度越高。 比如:...
docker-操作实战
前言 C镜像制作 因为我平常不用,所以不书写了 SpringBoot 微服务镜像制作 mkdir java ca java cp /data/maxhou/myapp/xxx.jar . vi Dockerfile FROM openjdk:8 COPY ./xxx.jar /app.jar CMD ["java","-jar","/app.jar"]COPY ./…...
后大模型时代智能体将成为“新宠”
智能体 |未来已来 智能体 |市场井喷 智能体 |定义 智能体 |与大模型的区别 智能体 |与Copilot的区别 智能体 |企业价值 智能体 |个体价值 智能体 |开发流程 智能体 |提示词解读 智能体 |应用场景 智能体 |重难点问题...
【MySQL】监控MySQL
目录 使用状态变量监控MySQL 使用性能模式(Performance Schema)监控MySQL 1.性能模式 2.性能模式设置表 3.sys模式 使用状态变量监控MySQL 使用 show status 语句评估系统运行状况。 可以添加范围修饰符global或session来显示全局或本地状态信息。…...
CTF类题目复现总结-[BSidesSF2020]toast-clicker 1
一、靶场地址 https://buuoj.cn/challenges#[BSidesSF2020]toast-clicker1二、复现步骤 1、下载压缩包,解压是apk文件; 2、利用 jadx apk反编译工具; jadx下载地址:https://github.com/skylot/jadx67, 83, 68, 120, 62, 109, …...
(更新完)Supplementary Material——AZ-NAS
6. Supplementary Material 在本补充材料中,我们提供了 AZ-NAS 在 NDS [18]、NAS-Bench-201 [7] 和 MobileNetV2 [14, 19] 搜索空间上的额外结果和深入分析。 Additional results on the NDS benchmark. 神经设计空间(NDS) [18] 基准提供了…...
基于SSM框架的线上甜品销售系统(源码+lw+部署文档+讲解),源码可白嫖!
摘要 网络技术和计算机技术发展至今,已经拥有了深厚的理论基础,并在现实中进行了充分运用,尤其是基于计算机运行的软件更是受到各界的关注。加上现在人们已经步入信息时代,所以对于信息的宣传和管理就很关键。因此网上销售信息的…...
TCP | 序列号和确认号 [逐包分析] | seq / ack 详解
注 : 本文为 “TCP 序号(seq)与确认序号(ack)” 相关文章合辑。 英文引文,机翻未校。 中文引文,略作重排。 如有内容异常,请看原文。 Understanding TCP Seq & Ack Numbers […...
Citus源码(1)分布式表行为测试
最近对citus的实现非常好奇,本篇对citus的行为做一些测试。本篇只测行为,不分析源码。后面会继续写一系列文章分析citus源码。 环境:3节点 PG17 with citus。 SELECT citus_set_coordinator_host(127.0.0.1, 3001); SELECT citus_add_node(1…...
【AI测试必学】DeepSeek API 快速入门:获取 API Key 与调用 API 步骤详解
DeepSeek API 快速入门:获取 API Key 与调用 API 步骤详解 一、获取 API Key二、调用 DeepSeek API方法 1:使用 OpenAI Python SDK 调用 DeepSeek API方法 2:使用 requests 库直接发送 HTTP 请求方法 3:使用 curl 命令 相关链接 一…...
Web前端之UniApp、Taro、ReactNative和Flutter的区别
MENU 前言介绍及公司技术差异使用方法使用场景差异注意事项打包与部署差异框架应用实例结语 前言 在移动应用开发领域,跨平台框架已成为开发者的得力工具。UniApp、Taro、ReactNative和Flutter它们在Android(安卓)或iOS(苹果&…...
[leetcode]map的用法
1. 定义和初始化 定义:std::map是一个关联容器,键值对会自动根据键的值进行排序(默认是升序)。 cpp复制 map<char, int> mp; 插入元素:可以通过operator[]或insert方法插入键值对。 cpp复制 mp[a] 1; mp[b] 3…...
PHP大马的使用
BestShell/best_php_shell.php at master Kevil-hui/BestShell 这里用到的是这位师傅的大马(主要是从头开始写一个大马实在太麻烦了) 用pikachu靶场进行上传的测试 在这里传马,这个是简单的前端校验,bp抓包改后缀就好了 上传成…...
【CC2530 教程 十】CC2530 Z-Stack 协议栈
一、Z-Stack 协议栈目录结构: Z-Stack 协议栈可以从 TI 官网免费下载,下载安装完成以后,会默认在 C 盘的根目录下创建 Texas Instruments 目录,该目录下的子目录就是安装的 Z-Stack 文件,并且在该子目录下创建Accessor…...
区间端点(java)(贪心问题————区间问题)
deepseek给了一种超级简单的做法 我是真的想不到 贪心的思路是 局部最优——>全局最优 这种我是真的没有想到,这样的好处就是后面便利的时候可以通过foreach循环直接便利qu的子元素也就是对应的某一个区间, 将一个二维数组变成一维数组,每一个一维…...
定长内存池原理及实现
目录 一、池化技术 二、内存池 三、内存池主要解决的问题 四、定长内存池的实现 1.定长内存池的原理 2.框架 3.Delete实现 4.New实现 5.性能测试 五、源码 FixedMemoryPool.h test.cc 一、池化技术 所谓“池化技术”,就是程序先向系统申请过量的资源&…...
通过php连接redis数据库
如上图所示,这是去搭建一个lamp平台, 阿帕奇和php安装好之后,php直接就被安装成阿帕奇的一个功能模块。 如上图所示,这就是php作为阿帕奇的功能模块。 如上图所示,我们去正常启动redis数据库。 如上图所示,…...
3D点云的深度学习网络分类(按照作用分类)
1. 3D目标检测(Object Detection) 用于在点云中识别和定位目标,输出3D边界框(Bounding Box)。 🔹 方法类别: 单阶段(Single-stage):直接预测3D目标位置&am…...
论文解读:《Word embedding factor based multi-head attention》——基于词嵌入因子的多头注意力
原文链接:Word embedding factor based multi-head attention | Artificial Intelligence Review 多头注意力机制线性地将查询、键和值投影到不同的子空间中,允许模型从不同的角度理解输入序列,并利用输入句子序列中有关令牌之间关系的信息。…...
单片机和微控制器知识汇总——《器件手册--单片机、数字信号处理器和可编程逻辑器件》
目录 四、单片机和微控制器 4.1 单片机(MCU/MPU/SOC) 一、定义 二、主要特点 三、工作原理 四、主要类型 五、应用领域 六、选型与设计注意事项 七、发展趋势 4.2 数字信号处理器(DSP/DSC) 编辑编辑 一、定义 二、工作原理 三、结构特点 四、应用领域 五、选型与设计注…...
LeetCode hot 100 每日一题(15)——48.旋转图像
这是一道难度为中等的题目,让我们来看看题目描述: 给定一个 n n 的二维矩阵 matrix 表示一个图像。请你将图像顺时针旋转 90 度。 你必须在 原地 旋转图像,这意味着你需要直接修改输入的二维矩阵。请不要 使用另一个矩阵来旋转图像。 提示…...
Java多线程精讲:线程操作与状态转换全解析
前言 本章内容为作者结合学习与实践的总结整理,虽力求准确,但疏漏之处在所难免。若有任何疑问或建议,恳请读者朋友们不吝指正,共同完善知识体系,感激不尽! 一、认识多线程(Thread&#…...
HashMap的位操作是什么?HashSet 的 contains 方法复杂度是多少?红黑树简单讲一下?
一、HashMap 的位操作设计 HashMap 使用位运算优化哈希计算与索引定位,核心场景如下: 哈希扰动函数 计算键的哈希值时,将高16位与低16位异或: static final int hash(Object key) {int h;return (key null) ? 0 : (h key.hash…...
GitHub开源的容器管理面板-Dpanel
dpanel Docker安装部署二进制部署 GitHub官网 一块轻量化docker可视化管理面板,由国人开发,个人觉得是比较好用的,功能都很齐全,并且可以通过修改源码,自定义前端样式等。 Docker安装部署 官网 部署环境࿱…...
vue-将组件内容导出为Word文档-docx
1. 安装依赖 首先,我们需要安装docx库,以便在前端生成Word文档。可以通过以下命令进行安装: npm install docx 2. 实现导出功能 2.1 初始化文档 使用docx库创建一个新的文档实例,并定义文档的结构和内容。我们使用Document、…...
IMX6ULL学习篇——系统学习设备树
IMX6ULL学习篇——系统学习设备树 这篇博客的目的是系统的整理一下设备树当中的一些非常基本的概念。基于之前的学习,我们已经至少掌握了字符设备的基本的框架,编写一个最简单的字符设备简单的流程。 但是我们知道,一个外设很有可能是…...
使用vector构造杨辉三角形
力扣118题: 给定一个非负整数 numRows,生成「杨辉三角」的前 numRows 行。 在「杨辉三角」中,每个数是它左上方和右上方的数的和。 示例 1: 输入: numRows 5 输出: [[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]]示例 2: 输入: numRows 1…...
亮数据爬取API爬取亚马逊电商平台实战教程
前言 在当今数据驱动的商业环境中,企业需要快速、精准地获取互联网上的公开数据以支持市场分析、竞品调研和用户行为研究。然而,传统的手动网页爬取方式面临着诸多挑战:IP封锁、验证码干扰、网站结构频繁变更,以及高昂的运维成本…...
AI+金融 应用 使用DeepSeek、Qwen等大模型输入自然语言,得到通达信等行情软件公式代码,导入后使用
AI金融 应用 使用DeepSeek、Qwen等大模型输入自然语言,得到通达信等行情软件公式代码,导入后使用。不会编程,也能行情软件中实现个性化条件选股,个性化技术指标。 AIbxm低估值趋势选股策略,参考提示词: 编…...
SmolVLM2: 让视频理解能力触手可及
一句话总结: SmolVLM 现已具备更强的视觉理解能力📺 SmolVLM2 标志着视频理解技术的根本性转变——从依赖海量计算资源的巨型模型,转向可在任何设备运行的轻量级模型。我们的目标很简单: 让视频理解技术从手机到服务器都能轻松部署。 我们同步发布三种规…...
去中心化金融
什么是去中心化金融 去中心化金融(Decentralized Finance,简称 DeFi)是一种基于区块链技术构建的金融系统,旨在通过去除传统金融机构(如银行、证券公司等)作为中介,提供各种金融服务。这些服务…...
Mysql并发事务带来哪些问题?
大家好,我是锋哥。今天分享关于【Mysql并发事务带来哪些问题?】面试题。希望对大家有帮助; Mysql并发事务带来哪些问题? 1000道 互联网大厂Java工程师 精选面试题-Java资源分享网 在 MySQL 中,事务并发执行时会引发一系列问题,…...
PCL 点云多平面探测
文章目录 一、简介二、实现代码三、实现效果参考资料一、简介 Open3D为我们提供了一种点云多平面探测的算法,该算法使用基于鲁棒统计的方法进行平面补丁检测。该算法具体过程:首先将点云细分为更小的块(使用二分法),然后尝试为每个点云块匹配一个平面。如果平面通过了鲁棒平…...
OpenBMC:BmcWeb添加路由5 设置handler函数
对路由对象完成了权限和method的设置后,最重要的就是设置路由的处理函数: //http\routing\taggedrule.hpptemplate <typename... Args> class TaggedRule :public BaseRule,public RuleParameterTraits<TaggedRule<Args...>> {...template <typename F…...
攻破tensorflow,勇创最佳agent(2)---损失(loss) 准确率(accuracy)问题
实战播: 怎么判定一个模型好不好,你设置的值对不对? 需要再看几个值: 例如: model Sequential()for units in model_structure:model.add(Dense(units, activationrelu))model.add(Dropout(train_config.get(dropout_rate, 0.3)))model.add(Dense(1, activationsigmoid)) 他…...
括号合法题
一、括号合法题 2116. 判断一个括号字符串是否有效 //采用从左往右和从右往左遍历的贪心算法,分别保证前缀合法,后缀合法。public boolean canBeValid(String s, String locked) {int ns.length();if (n%21) return false;int num0;// 从左到右扫描&…...
C++11之深度理解lambda表达式
前言 在现代C中,Lambda表达式提供了一种简洁而强大的方式来定义匿名函数,使代码更具可读性和灵活性。自C11引入Lambda以来,它已经成为STL算法、并发编程和回调机制中的重要工具。随着C14、C17和C20的不断演进,Lambda的功能也在不断…...