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

vxe-table v4.8+ 与 v3.10+ 导出 xlsx、支持导出合并、设置样式、宽高、边框、字体、背景、超链接、图片的详细介绍,一篇就够了

Vxe UI vue vxe-table v4.8+ 与 v3.10+ 导出 xlsx、支持导出合并、设置样式、宽高、边框、字体、背景、超链接、图片等、所有常用的 Excel 格式都能自定义,使用非常简单,纯前端实现复杂的导出。

安装插件

npm install vxe-pc-ui@4.2.39 vxe-table@4.8.0 @vxe-ui/plugin-export-xlsx@4.0.7 exceljs@4.4.0
// ...
import { VxeUI } from 'vxe-pc-ui'
import VxeUIPluginExportXLSX from '@vxe-ui/plugin-export-xlsx'
// ...VxeUI.use(VxeUIPluginExportXLSX)

在 index.html 引入对应的解析库,把对应的 js 下载到本地引入。

<script src="https://vxeui.com/umd/exceljs@4.4.0/dist/exceljs.min.js"></script>

默认导出

默认支持文本和单元格合并等导出,只需要开启对应的功能就可以直接使用了。
在这里插入图片描述

在这里插入图片描述

<template><div><vxe-button @click="exportEvent">高级导出</vxe-button><vxe-grid ref="gridRef" v-bind="gridOptions"></vxe-grid></div>
</template><script setup>
import { ref, reactive } from 'vue'const gridRef = ref()const gridOptions = reactive({border: true,showFooter: true,mergeCells: [{ row: 0, col: 2, rowspan: 2, colspan: 2 },{ row: 2, col: 1, rowspan: 3, colspan: 2 }],exportConfig: {type: 'xlsx'},columns: [{ field: 'seq', type: 'seq', width: 70 },{title: '分组1',children: [{ field: 'name', title: 'Name' },{ field: 'role', title: 'Role' }]},{ field: 'sex', title: 'Sex' },{ field: 'age', title: 'Age' }],data: [{ id: 10001, name: '张三', role: 'Develop', sex: 'Man', age: 28, address: 'test abc' },{ id: 10002, name: '李四', role: 'Test', sex: 'Women', age: 22, address: '广东省' },{ id: 10003, name: '王五', role: 'PM', sex: 'Man', age: 32, address: '上海' },{ id: 10004, name: '老六', role: 'Designer', sex: 'Women', age: 24, address: 'Shanghai' },{ id: 10005, name: '小七', role: 'Designer', sex: 'Man', age: 37, address: '广东省' },{ id: 10006, name: '小八', role: 'Designer', sex: 'Man', age: 39, address: 'Shanghai' }],footerData: [{ seq: '合计', name: '12人', no1: 356 }]
})const exportEvent = () => {const $grid = gridRef.valueif ($grid) {$grid.openExport()}
}
</script>

参数说明

通过 sheetMethod 自定义方法实现,参数说明 exportConfig.sheetMethod({
workbook 工作簿对象
worksheet 表对象
options 当前参数
})

自定义边框

在这里插入图片描述

<template><div><vxe-button @click="exportEvent">点击导出</vxe-button><vxe-grid ref="gridRef" v-bind="gridOptions"></vxe-grid></div>
</template><script setup>
import { ref, reactive } from 'vue'const gridRef = ref()const gridOptions = reactive({border: true,showFooter: true,exportConfig: {sheetMethod (params) {const { worksheet } = paramsworksheet.eachRow(excelRow => {excelRow.eachCell(excelCell => {// 设置单元格边框excelCell.border = {top: {style: 'thin',color: {argb: 'ff0000'}},left: {style: 'thin',color: {argb: 'ff0000'}},bottom: {style: 'thin',color: {argb: 'ff0000'}},right: {style: 'thin',color: {argb: 'ff0000'}}}})})}},columns: [{ field: 'seq', type: 'seq', width: 70 },{title: '分组1',children: [{ field: 'name', title: 'Name' },{ field: 'role', title: 'Role' }]},{ field: 'sex', title: 'Sex' },{ field: 'no1', title: 'NO1' },{ field: 'no2', title: 'NO2 String', cellType: 'string' }],data: [{ id: 10001, name: '张三', role: 'Develop', sex: 'Man', no1: '028', no2: '028' },{ id: 10002, name: '李四', role: '研发', sex: 'Women', no1: '220', no2: '220' },{ id: 10003, name: '王五', role: '产品经理', sex: 'Man', no1: '003200', no2: '003200' },{ id: 10004, name: '老六', role: 'Designer', sex: 'Women', no1: '02040', no2: '02040' }],footerData: [{ seq: '合计', name: '12人', no1: '356' }]
})const exportEvent = () => {const $grid = gridRef.valueif ($grid) {$grid.exportData({type: 'xlsx'})}
}
</script>

自定义字体

在这里插入图片描述

<template><div><vxe-button @click="exportEvent">点击导出</vxe-button><vxe-grid ref="gridRef" v-bind="gridOptions"></vxe-grid></div>
</template><script setup>
import { ref, reactive } from 'vue'const gridRef = ref()const gridOptions = reactive({border: true,showFooter: true,exportConfig: {sheetMethod (params) {const { worksheet } = paramsworksheet.eachRow(excelRow => {excelRow.eachCell(excelCell => {// 设置单元格字体excelCell.font = {bold: true,size: 16,color: {argb: 'ff0000'}}})})}},columns: [{ field: 'seq', type: 'seq', width: 70 },{title: '分组1',children: [{ field: 'name', title: 'Name' },{ field: 'role', title: 'Role' }]},{ field: 'sex', title: 'Sex' },{ field: 'no1', title: 'NO1' },{ field: 'no2', title: 'NO2 String', cellType: 'string' }],data: [{ id: 10001, name: '张三', role: 'Develop', sex: 'Man', no1: '028', no2: '028' },{ id: 10002, name: '李四', role: '研发', sex: 'Women', no1: '220', no2: '220' },{ id: 10003, name: '王五', role: '产品经理', sex: 'Man', no1: '003200', no2: '003200' },{ id: 10004, name: '老六', role: 'Designer', sex: 'Women', no1: '02040', no2: '02040' }],footerData: [{ seq: '合计', name: '12人', no1: '356' }]
})const exportEvent = () => {const $grid = gridRef.valueif ($grid) {$grid.exportData({type: 'xlsx'})}
}
</script>

自定义表头背景

在这里插入图片描述

<template><div><vxe-button @click="exportEvent">点击导出</vxe-button><vxe-grid ref="gridRef" v-bind="gridOptions"></vxe-grid></div>
</template><script setup>
import { ref, reactive } from 'vue'const gridRef = ref()const gridOptions = reactive({border: true,showFooter: true,exportConfig: {sheetMethod (params) {const { worksheet } = paramsworksheet.eachRow((excelRow, rowIndex) => {if (rowIndex <= 2) {excelRow.eachCell(excelCell => {// 填充单元格背景excelCell.fill = {type: 'pattern',pattern: 'solid',fgColor: {argb: 'c5d9f1'}}})}})}},columns: [{ field: 'seq', type: 'seq', width: 70 },{title: '分组1',children: [{ field: 'name', title: 'Name' },{ field: 'role', title: 'Role' }]},{ field: 'sex', title: 'Sex' },{ field: 'no1', title: 'NO1' },{ field: 'no2', title: 'NO2 String', cellType: 'string' }],data: [{ id: 10001, name: '张三', role: 'Develop', sex: 'Man', no1: '028', no2: '028' },{ id: 10002, name: '李四', role: '研发', sex: 'Women', no1: '220', no2: '220' },{ id: 10003, name: '王五', role: '产品经理', sex: 'Man', no1: '003200', no2: '003200' },{ id: 10004, name: '老六', role: 'Designer', sex: 'Women', no1: '02040', no2: '02040' }],footerData: [{ seq: '合计', name: '12人', no1: '356' }]
})const exportEvent = () => {const $grid = gridRef.valueif ($grid) {$grid.exportData({type: 'xlsx'})}
}
</script>

自定义列宽

覆盖默认的列宽
在这里插入图片描述

<template><div><vxe-button @click="exportEvent">点击导出</vxe-button><vxe-grid ref="gridRef" v-bind="gridOptions"></vxe-grid></div>
</template><script setup>
import { ref, reactive } from 'vue'const gridRef = ref()const gridOptions = reactive({border: true,showFooter: true,exportConfig: {async sheetMethod (params) {const { worksheet } = paramsworksheet.columns.forEach(sheetColumn => {// 设置列宽sheetColumn.width = 16})}},columns: [{ field: 'seq', type: 'seq', width: 70 },{title: '分组1',children: [{ field: 'name', title: 'Name' },{ field: 'role', title: 'Role' }]},{ field: 'sex', title: 'Sex' },{ field: 'no1', title: 'NO1' },{ field: 'no2', title: 'NO2 String', cellType: 'string' }],data: [{ id: 10001, name: '张三', role: 'Develop', sex: 'Man', no1: '028', no2: '028' },{ id: 10002, name: '李四', role: '研发', sex: 'Women', no1: '220', no2: '220' },{ id: 10003, name: '王五', role: '产品经理', sex: 'Man', no1: '003200', no2: '003200' },{ id: 10004, name: '老六', role: 'Designer', sex: 'Women', no1: '02040', no2: '02040' }],footerData: [{ seq: '合计', name: '12人', no1: '356' }]
})const exportEvent = () => {const $grid = gridRef.valueif ($grid) {$grid.exportData({type: 'xlsx'})}
}
</script>

自定义行高

覆盖默认的行高
在这里插入图片描述

<template><div><vxe-button @click="exportEvent">点击导出</vxe-button><vxe-grid ref="gridRef" v-bind="gridOptions"></vxe-grid></div>
</template><script setup>
import { ref, reactive } from 'vue'const gridRef = ref()const gridOptions = reactive({border: true,showFooter: true,exportConfig: {async sheetMethod (params) {const { worksheet } = paramsworksheet.eachRow((excelRow, rowIndex) => {// 设置行高excelRow.height = 60})}},columns: [{ field: 'seq', type: 'seq', width: 70 },{title: '分组1',children: [{ field: 'name', title: 'Name' },{ field: 'role', title: 'Role' }]},{ field: 'sex', title: 'Sex' },{ field: 'no1', title: 'NO1' },{ field: 'no2', title: 'NO2 String', cellType: 'string' }],data: [{ id: 10001, name: '张三', role: 'Develop', sex: 'Man', no1: '028', no2: '028' },{ id: 10002, name: '李四', role: '研发', sex: 'Women', no1: '220', no2: '220' },{ id: 10003, name: '王五', role: '产品经理', sex: 'Man', no1: '003200', no2: '003200' },{ id: 10004, name: '老六', role: 'Designer', sex: 'Women', no1: '02040', no2: '02040' }],footerData: [{ seq: '合计', name: '12人', no1: '356' }]
})const exportEvent = () => {const $grid = gridRef.valueif ($grid) {$grid.exportData({type: 'xlsx'})}
}
</script>

添加超链接

在这里插入图片描述

<template><div><vxe-button @click="exportEvent">点击导出</vxe-button><vxe-grid ref="gridRef" v-bind="gridOptions"></vxe-grid></div>
</template><script setup>
import { ref, reactive } from 'vue'const gridRef = ref()const gridOptions = reactive({border: true,showFooter: true,exportConfig: {sheetMethod (params) {const { worksheet } = paramsworksheet.eachRow((excelRow, rowIndex) => {if (rowIndex > 2) {excelRow.eachCell((excelCell, columnIndex) => {if (columnIndex === 2) {// 设置指定单元格为超链接excelCell.value = {text: `${excelCell.value}`,hyperlink: 'https://vxeui.com',tooltip: 'vxeui.com'}// 设置单元格字体excelCell.font = {color: {argb: '0000ff'}}}})}})}},columns: [{ field: 'seq', type: 'seq', width: 70 },{title: '分组1',children: [{ field: 'name', title: 'Name' },{ field: 'role', title: 'Role' }]},{ field: 'sex', title: 'Sex' },{ field: 'no1', title: 'NO1' },{ field: 'no2', title: 'NO2 String', cellType: 'string' }],data: [{ id: 10001, name: '张三', role: 'Develop', sex: 'Man', no1: '028', no2: '028' },{ id: 10002, name: '李四', role: '研发', sex: 'Women', no1: '220', no2: '220' },{ id: 10003, name: '王五', role: '产品经理', sex: 'Man', no1: '003200', no2: '003200' },{ id: 10004, name: '老六', role: 'Designer', sex: 'Women', no1: '02040', no2: '02040' }],footerData: [{ seq: '合计', name: '12人', no1: '356' }]
})const exportEvent = () => {const $grid = gridRef.valueif ($grid) {$grid.exportData({type: 'xlsx'})}
}
</script>

添加图片

图片支持 buffer 和 base64 格式。
在这里插入图片描述

<template><div><vxe-button @click="exportEvent">点击导出</vxe-button><vxe-grid ref="gridRef" v-bind="gridOptions"></vxe-grid></div>
</template><script setup>
import { ref, reactive } from 'vue'const gridRef = ref()const gridOptions = reactive({border: true,showFooter: true,exportConfig: {async sheetMethod (params) {const { worksheet, workbook } = params// 加载图片const buffer1 = await fetch('https://vxeui.com/logo.png').then(res => res.arrayBuffer())const imageId1 = workbook.addImage({buffer: buffer1,extension: 'png'})worksheet.eachRow((excelRow, rowIndex) => {if (rowIndex > 2) {// 设置行高excelRow.height = 60excelRow.eachCell((excelCell, columnIndex) => {if (columnIndex === 2) {// 将图片添加到单元格worksheet.addImage(imageId1, {tl: { col: columnIndex - 1, row: rowIndex - 1 },ext: { width: 40, height: 40 }})}})}})}},columns: [{ field: 'seq', type: 'seq', width: 70 },{title: '分组1',children: [{ field: 'name', title: 'Name' },{ field: 'role', title: 'Role' }]},{ field: 'sex', title: 'Sex' },{ field: 'no1', title: 'NO1' },{ field: 'no2', title: 'NO2 String', cellType: 'string' }],data: [{ id: 10001, name: '张三', role: 'Develop', sex: 'Man', no1: '028', no2: '028' },{ id: 10002, name: '李四', role: '研发', sex: 'Women', no1: '220', no2: '220' },{ id: 10003, name: '王五', role: '产品经理', sex: 'Man', no1: '003200', no2: '003200' },{ id: 10004, name: '老六', role: 'Designer', sex: 'Women', no1: '02040', no2: '02040' }],footerData: [{ seq: '合计', name: '12人', no1: '356' }]
})
const exportEvent = () => {const $grid = gridRef.valueif ($grid) {$grid.exportData({type: 'xlsx'})}
}
</script>

github https://github.com/x-extends/vxe-table
gitee

相关文章:

vxe-table v4.8+ 与 v3.10+ 导出 xlsx、支持导出合并、设置样式、宽高、边框、字体、背景、超链接、图片的详细介绍,一篇就够了

Vxe UI vue vxe-table v4.8 与 v3.10 导出 xlsx、支持导出合并、设置样式、宽高、边框、字体、背景、超链接、图片等、所有常用的 Excel 格式都能自定义&#xff0c;使用非常简单&#xff0c;纯前端实现复杂的导出。 安装插件 npm install vxe-pc-ui4.2.39 vxe-table4.8.0 vx…...

江协科技STM32学习- P36 SPI通信外设

&#x1f680;write in front&#x1f680; &#x1f50e;大家好&#xff0c;我是黄桃罐头&#xff0c;希望你看完之后&#xff0c;能对你有所帮助&#xff0c;不足请指正&#xff01;共同学习交流 &#x1f381;欢迎各位→点赞&#x1f44d; 收藏⭐️ 留言&#x1f4dd;​…...

【大数据】ClickHouse常见的表引擎及建表语法

ClickHouse 中最强大的表引擎当属 MergeTree &#xff08;合并树&#xff09;引擎及该系列&#xff08;*MergeTree&#xff09;中的其他引擎。接下来我们就仔细了解下MergeTree 及该系列的其他引擎的使用场景及建表语法。 MergeTree MergeTree 系列的引擎被设计用于插入极大量…...

explain执行计划分析 ref_

这里写目录标题 什么是ExplainExplain命令扩展explain extendedexplain partitions 两点重要提示本文示例使用的数据库表Explain命令(关键字)explain简单示例explain结果列说明【id列】【select_type列】【table列】【type列】 【possible_keys列】【key列】【key_len列】【ref…...

网络学习/复习4传输层

1,0...

Notepad++ 更改字体大小和颜色

前言 在长时间编程或文本编辑过程中&#xff0c;合适的字体大小和颜色可以显著提高工作效率和减少眼睛疲劳。Notepad 提供了丰富的自定义选项&#xff0c;让你可以根据个人喜好调整编辑器的外观。 步骤详解 1. 更改字体大小 打开 Notepad 启动 Notepad 编辑器。 进入设置菜…...

基于SSM+小程序的宿舍管理系统(宿舍1)

&#x1f449;文末查看项目功能视频演示获取源码sql脚本视频导入教程视频 1、项目介绍 本宿舍管理系统小程序有管理员和学生两个角色。 1、管理员功能有个人中心&#xff0c;公告信息管理&#xff0c;班级管理&#xff0c;学生管理&#xff0c;宿舍信息管理&#xff0c;宿舍…...

【案例分享】TeeChart 如何为人类绩效解决方案提供数据洞察

“过去二十年来&#xff0c;我们一直在使用 Steema Software 产品&#xff0c;尤其是 TeeChart&#xff0c;这是我们软件开发的基础部分。看到 TeeChart 在这段时间里不断发展、改进和增加功能&#xff0c;真是太棒了&#xff0c;这极大地增强了我们的产品。Steema 的客户和技术…...

细谈 Linux 中的多路复用epoll

大家好&#xff0c;我是 V 哥。在 Linux 中&#xff0c;epoll 是一种多路复用机制&#xff0c;用于高效地处理大量文件描述符&#xff08;file descriptor, FD&#xff09;事件。与传统的select和poll相比&#xff0c;epoll具有更高的性能和可扩展性&#xff0c;特别是在大规模…...

51c自动驾驶~合集4

我自己的原文哦~ https://blog.51cto.com/whaosoft/12413878 #MCTrack 迈驰&旷视最新MCTrack&#xff1a;KITTI/nuScenes/Waymo三榜单SOTA paper&#xff1a;MCTrack: A Unified 3D Multi-Object Tracking Framework for Autonomous Driving code&#xff1a;https://gi…...

回归预测 | MATLAB实现BO-BiGRU贝叶斯优化双向门控循环单元多输入单输出回归预测

要在MATLAB中实现BO-BiGRU&#xff08;贝叶斯优化双向门控循环单元&#xff09;进行多输入单输出回归预测&#xff0c;您需要执行以下步骤&#xff1a; 数据准备&#xff1a;准备您的训练数据和测试数据。 模型构建&#xff1a;构建BO-BiGRU模型&#xff0c;可以使用MATLAB中的…...

2-ARM Linux驱动开发-设备树平台驱动

一、概述 设备树(Device Tree)是一种描述硬件的数据结构&#xff0c;用于将硬件设备的信息传递给操作系统内核。它的主要作用是使内核能够以一种统一、灵活的方式了解硬件平台的细节&#xff0c;包括设备的拓扑结构、资源分配&#xff08;如内存地址、中断号等&#xff09;等信…...

C语言函数与递归

函数 函数是指将一组能完成一个功能或多个功能的语句放在一起的代码结构。在C语言程序中&#xff0c;至少会包含一个函数&#xff0c;主函数main()。本章将详细讲解关于函数的相关内容。 1、库函数 ⭕️C语言库函数是指在C语言标准库中预先定义好的函数&#xff0c;这些函数包…...

Linux下的Debugfs

debugfs 1. 简介 类似sysfs、procfs&#xff0c;debugfs 也是一种内存文件系统。不过不同于sysfs一个kobject对应一个文件&#xff0c;procfs和进程相关的特性&#xff0c;debugfs的灵活度很大&#xff0c;可以根据需求对指定的变量进行导出并提供读写接口。debugfs又是一个Li…...

【FFmpeg】调整音频文件的音量

1、调整音量的命令 1)音量调整为当前音量的十倍 ffmpeg -i inputfile -vol 1000 outputfile 2)音量调整为当前音量的一半 ffmpeg -i input.wav -filter:a "volume=0.5" output.wav3)静音 ffmpeg -i input.wav -filter:a "volume=0" output.wav4)…...

mac 打开访达快捷键

一、使用快捷键组合 1. Command N 在当前桌面或应用程序窗口中&#xff0c;按下“Command N”组合键可以快速打开一个新的访达窗口。这就像在 Windows 系统中通过“Ctrl N”打开新的资源管理器窗口一样。 2. Command Tab 切换 如果访达已经打开&#xff0c;只是被其他应…...

Ubuntu学习笔记 - Day2

文章目录 学习目标&#xff1a;学习内容&#xff1a;学习笔记&#xff1a;Linux系统启动过程内核引导运行init运行级别系统初始化建立终端用户登录系统 Ubuntu关机关机流程相关命令 Linux系统目录结构查看目录目录结构 文件基本属性读写权限命令 下载文件的方法安装wget工具下载…...

c++基础12比较/逻辑运算符

比较/逻辑运算符 布尔比较运算符逻辑运算符位运算符&#xff08;也用于逻辑运算&#xff09;1<a<10怎么表达T140399判断是否为两位数代码 布尔 在C中&#xff0c;布尔类型是一种基本数据类型&#xff0c;用于表示逻辑值&#xff0c;即真&#xff08;true&#xff09;或假…...

mac-ubuntu虚拟机(扩容-共享-vmtools)

一、磁盘扩容 使用GParted工具对Linux磁盘空间进行扩展 https://blog.csdn.net/Time_Waxk/article/details/105675468 经过上面的方式后还不够&#xff0c;需要再进行下面的操作 lvextend 用于扩展逻辑卷的大小&#xff0c;-l 选项允许指定大小。resize2fs 用于调整文件系统的…...

数学建模学习(135):使用Python基于WSM、WPM、WASPAS的多准则决策分析

1. 算法介绍 多标准决策分析(Multi-Criteria Decision Analysis, MCDA)是帮助决策者在复杂环境下做出合理选择的重要工具。WSM(加权和法)、WPM(加权乘积法)、WASPAS(加权和乘积评估法)是 MCDA 中的三种常用算法。它们广泛应用于工程、经济、供应链管理等多个领域,用于…...

Java 语言特性(面试系列1)

一、面向对象编程 1. 封装&#xff08;Encapsulation&#xff09; 定义&#xff1a;将数据&#xff08;属性&#xff09;和操作数据的方法绑定在一起&#xff0c;通过访问控制符&#xff08;private、protected、public&#xff09;隐藏内部实现细节。示例&#xff1a; public …...

YSYX学习记录(八)

C语言&#xff0c;练习0&#xff1a; 先创建一个文件夹&#xff0c;我用的是物理机&#xff1a; 安装build-essential 练习1&#xff1a; 我注释掉了 #include <stdio.h> 出现下面错误 在你的文本编辑器中打开ex1文件&#xff0c;随机修改或删除一部分&#xff0c;之后…...

苍穹外卖--缓存菜品

1.问题说明 用户端小程序展示的菜品数据都是通过查询数据库获得&#xff0c;如果用户端访问量比较大&#xff0c;数据库访问压力随之增大 2.实现思路 通过Redis来缓存菜品数据&#xff0c;减少数据库查询操作。 缓存逻辑分析&#xff1a; ①每个分类下的菜品保持一份缓存数据…...

如何为服务器生成TLS证书

TLS&#xff08;Transport Layer Security&#xff09;证书是确保网络通信安全的重要手段&#xff0c;它通过加密技术保护传输的数据不被窃听和篡改。在服务器上配置TLS证书&#xff0c;可以使用户通过HTTPS协议安全地访问您的网站。本文将详细介绍如何在服务器上生成一个TLS证…...

ArcGIS Pro制作水平横向图例+多级标注

今天介绍下载ArcGIS Pro中如何设置水平横向图例。 之前我们介绍了ArcGIS的横向图例制作&#xff1a;ArcGIS横向、多列图例、顺序重排、符号居中、批量更改图例符号等等&#xff08;ArcGIS出图图例8大技巧&#xff09;&#xff0c;那这次我们看看ArcGIS Pro如何更加快捷的操作。…...

听写流程自动化实践,轻量级教育辅助

随着智能教育工具的发展&#xff0c;越来越多的传统学习方式正在被数字化、自动化所优化。听写作为语文、英语等学科中重要的基础训练形式&#xff0c;也迎来了更高效的解决方案。 这是一款轻量但功能强大的听写辅助工具。它是基于本地词库与可选在线语音引擎构建&#xff0c;…...

Java + Spring Boot + Mybatis 实现批量插入

在 Java 中使用 Spring Boot 和 MyBatis 实现批量插入可以通过以下步骤完成。这里提供两种常用方法&#xff1a;使用 MyBatis 的 <foreach> 标签和批处理模式&#xff08;ExecutorType.BATCH&#xff09;。 方法一&#xff1a;使用 XML 的 <foreach> 标签&#xff…...

【无标题】路径问题的革命性重构:基于二维拓扑收缩色动力学模型的零点隧穿理论

路径问题的革命性重构&#xff1a;基于二维拓扑收缩色动力学模型的零点隧穿理论 一、传统路径模型的根本缺陷 在经典正方形路径问题中&#xff08;图1&#xff09;&#xff1a; mermaid graph LR A((A)) --- B((B)) B --- C((C)) C --- D((D)) D --- A A -.- C[无直接路径] B -…...

Webpack性能优化:构建速度与体积优化策略

一、构建速度优化 1、​​升级Webpack和Node.js​​ ​​优化效果​​&#xff1a;Webpack 4比Webpack 3构建时间降低60%-98%。​​原因​​&#xff1a; V8引擎优化&#xff08;for of替代forEach、Map/Set替代Object&#xff09;。默认使用更快的md4哈希算法。AST直接从Loa…...

十九、【用户管理与权限 - 篇一】后端基础:用户列表与角色模型的初步构建

【用户管理与权限 - 篇一】后端基础:用户列表与角色模型的初步构建 前言准备工作第一部分:回顾 Django 内置的 `User` 模型第二部分:设计并创建 `Role` 和 `UserProfile` 模型第三部分:创建 Serializers第四部分:创建 ViewSets第五部分:注册 API 路由第六部分:后端初步测…...