news 2026/7/18 20:25:22

3步掌握JsBarcode:JavaScript条形码生成全攻略

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
3步掌握JsBarcode:JavaScript条形码生成全攻略

3步掌握JsBarcode:JavaScript条形码生成全攻略

【免费下载链接】JsBarcodeBarcode generation library written in JavaScript that works in both the browser and on Node.js项目地址: https://gitcode.com/gh_mirrors/js/JsBarcode

JsBarcode是一个纯JavaScript编写的条形码生成库,支持在浏览器和Node.js环境中使用,无需任何外部依赖即可生成多种行业标准条形码格式。无论是电商网站的商品编码、物流系统的追踪标签,还是企业内部的管理系统,JsBarcode都能提供简单高效的条形码生成解决方案。

为什么选择JsBarcode:三大核心优势

🚀 零依赖跨平台运行

JsBarcode最大的优势在于其零依赖设计,既可以在浏览器中直接使用,也可以在Node.js服务器端运行。这意味着你可以:

  • 前端直接生成:在用户浏览器中实时生成条形码,减少服务器压力
  • 服务端预生成:在Node.js服务器上批量生成条形码图片
  • 混合应用支持:在React Native、Electron等混合应用中使用

📊 支持12种行业标准格式

JsBarcode支持几乎所有主流的条形码格式,满足不同行业需求:

零售行业格式

  • EAN-13:国际商品编码(13位数字)
  • EAN-8:小型商品编码(8位数字)
  • UPC-A:北美商品编码(12位数字)
  • UPC-E:压缩版UPC编码(6位数字)

物流与仓储格式

  • CODE128:高密度工业编码(支持A/B/C三种子集)
  • ITF/ITF-14:交插二五码,物流包装专用
  • CODE39:字母数字混合编码

特殊应用格式

  • Pharmacode:药品编码系统
  • Codabar:图书馆、血库专用编码
  • MSI:仓库库存管理系统
  • CODE93:高密度工业编码

🎯 灵活的渲染输出

支持三种主流渲染方式,适应不同应用场景:

// SVG渲染 - 矢量图形,无限缩放不失真 <svg id="barcode"></svg> // Canvas渲染 - 适合动态生成和图片处理 <canvas id="barcode"></canvas> // Image渲染 - 最简单的集成方式 <img id="barcode"/>

快速入门:5分钟创建第一个条形码

步骤1:安装与引入

根据你的项目需求选择安装方式:

# 使用npm安装 npm install jsbarcode --save # 使用yarn安装 yarn add jsbarcode # 或者直接通过CDN引入 <script src="https://cdn.jsdelivr.net/npm/jsbarcode@latest/dist/JsBarcode.all.min.js"></script>

步骤2:创建HTML容器

在HTML中添加一个条形码显示容器:

<!DOCTYPE html> <html> <head> <title>JsBarcode示例</title> </head> <body> <!-- 选择任意一种容器 --> <svg id="myBarcode"></svg> <!-- 或者 --> <canvas id="myBarcode"></canvas> <!-- 或者 --> <img id="myBarcode"/> <script src="jsbarcode.min.js"></script> <script> // 条形码生成代码将在这里 </script> </body> </html>

步骤3:生成条形码

使用一行代码生成你的第一个条形码:

// 最简单的用法 JsBarcode("#myBarcode", "123456789012"); // 带配置选项的用法 JsBarcode("#myBarcode", "9780199532179", { format: "EAN13", width: 2, height: 100, displayValue: true, fontSize: 20, textMargin: 10, background: "#ffffff", lineColor: "#000000" });

高级配置:定制化条形码样式

基础样式配置

JsBarcode提供了丰富的配置选项来定制条形码的外观:

JsBarcode("#barcode", "123456789012", { // 条形码格式 format: "CODE128", // 尺寸控制 width: 2, // 条码宽度(像素) height: 100, // 条码高度(像素) margin: 10, // 边距 // 文本显示 displayValue: true, // 是否显示文本 text: "自定义文本", // 自定义显示文本 font: "Arial", // 字体 fontSize: 16, // 字体大小 textMargin: 5, // 文本与条码间距 textPosition: "bottom", // 文本位置:top/bottom // 颜色配置 lineColor: "#000000", // 条码颜色 background: "#ffffff", // 背景颜色 // 其他选项 flat: false, // 是否扁平化(移除空白区域) valid: function(valid) { // 验证回调函数 console.log("条形码是否有效:", valid); } });

响应式条形码设计

创建自适应容器宽度的条形码:

function createResponsiveBarcode(containerId, value) { const container = document.getElementById(containerId); const containerWidth = container.clientWidth; JsBarcode(`#${containerId}`, value, { format: "CODE128", width: Math.max(1, containerWidth / 150), // 动态宽度 height: Math.max(50, containerWidth / 8), // 动态高度 displayValue: true, fontSize: Math.max(12, containerWidth / 30), margin: Math.max(5, containerWidth / 50) }); } // 监听窗口大小变化 window.addEventListener('resize', () => { createResponsiveBarcode('myBarcode', '123456789012'); }); // 初始化 createResponsiveBarcode('myBarcode', '123456789012');

实际应用场景:从电商到物流的全面解决方案

场景1:电商商品管理系统

为电商平台的商品生成标准EAN-13条形码:

class ProductBarcodeGenerator { constructor() { this.productCache = new Map(); } generateProductBarcode(productId, productName, price) { // 检查缓存 const cacheKey = `${productId}-${productName}`; if (this.productCache.has(cacheKey)) { return this.productCache.get(cacheKey); } // 创建Canvas元素 const canvas = document.createElement('canvas'); // 生成条形码 JsBarcode(canvas, productId, { format: "EAN13", width: 2, height: 80, displayValue: true, text: `${productName} - ¥${price}`, fontSize: 14, textMargin: 8, margin: 15 }); // 转换为DataURL并缓存 const dataUrl = canvas.toDataURL('image/png'); this.productCache.set(cacheKey, dataUrl); return dataUrl; } // 批量生成商品条形码 batchGenerate(products) { return products.map(product => ({ ...product, barcode: this.generateProductBarcode( product.id, product.name, product.price ) })); } } // 使用示例 const generator = new ProductBarcodeGenerator(); const products = [ { id: "123456789012", name: "无线蓝牙耳机", price: 299 }, { id: "234567890123", name: "智能手环", price: 199 }, { id: "345678901234", name: "移动电源", price: 89 } ]; const productsWithBarcodes = generator.batchGenerate(products);

场景2:物流追踪系统

为物流单号生成CODE128格式的追踪条形码:

class LogisticsBarcodeSystem { constructor() { this.trackingPrefix = "TRK"; } generateTrackingBarcode(trackingNumber, destination, weight) { const fullCode = `${this.trackingPrefix}${trackingNumber}`; const canvas = document.createElement('canvas'); JsBarcode(canvas, fullCode, { format: "CODE128", width: 2, height: 60, displayValue: true, text: `运单号: ${trackingNumber} | 目的地: ${destination} | 重量: ${weight}kg`, fontSize: 12, lineColor: "#1a73e8", // 物流蓝色 background: "#f8f9fa", margin: 10 }); return { barcodeData: canvas.toDataURL('image/png'), trackingCode: fullCode, metadata: { trackingNumber, destination, weight, generatedAt: new Date().toISOString() } }; } // 生成批量物流标签 generateBatchLabels(shipments) { const labels = []; shipments.forEach((shipment, index) => { const label = this.generateTrackingBarcode( shipment.trackingNumber, shipment.destination, shipment.weight ); labels.push({ ...label, position: index + 1, page: Math.floor(index / 4) + 1 // 每页4个标签 }); }); return labels; } }

Node.js服务端集成:批量生成与处理

服务端条形码生成

在Node.js环境中使用Canvas生成条形码:

const JsBarcode = require('jsbarcode'); const { createCanvas } = require('canvas'); const fs = require('fs'); const path = require('path'); class ServerBarcodeGenerator { constructor(outputDir = './barcodes') { this.outputDir = outputDir; // 确保输出目录存在 if (!fs.existsSync(outputDir)) { fs.mkdirSync(outputDir, { recursive: true }); } } // 生成单个条形码并保存为文件 generateAndSave(value, filename, options = {}) { return new Promise((resolve, reject) => { try { // 创建Canvas const canvas = createCanvas(400, 200); // 默认配置 const defaultOptions = { format: "CODE128", width: 2, height: 100, displayValue: true, fontSize: 18, background: "#ffffff", lineColor: "#000000", margin: 20 }; // 合并配置 const finalOptions = { ...defaultOptions, ...options }; // 生成条形码 JsBarcode(canvas, value, finalOptions); // 保存为PNG文件 const filePath = path.join(this.outputDir, filename); const buffer = canvas.toBuffer('image/png'); fs.writeFileSync(filePath, buffer); resolve({ success: true, filePath, value, options: finalOptions }); } catch (error) { reject({ success: false, error: error.message, value, filename }); } }); } // 批量生成条形码 async batchGenerate(items) { const results = []; for (const item of items) { try { const result = await this.generateAndSave( item.value, item.filename, item.options ); results.push(result); } catch (error) { results.push(error); } } return { total: items.length, success: results.filter(r => r.success).length, failed: results.filter(r => !r.success).length, results }; } // 生成商品条形码批量任务 async generateProductBarcodes(products) { const items = products.map((product, index) => ({ value: product.sku || product.id, filename: `product_${index + 1}_${Date.now()}.png`, options: { format: "EAN13", text: `${product.name} - ${product.category}`, fontSize: 16, height: 120, lineColor: "#2c3e50" } })); return await this.batchGenerate(items); } } // 使用示例 const generator = new ServerBarcodeGenerator('./output/barcodes'); const products = [ { sku: "8801234567890", name: "智能手机", category: "电子产品" }, { sku: "8802345678901", name: "无线耳机", category: "音频设备" }, { sku: "8803456789012", name: "智能手表", category: "可穿戴设备" } ]; generator.generateProductBarcodes(products) .then(report => { console.log(`批量生成完成:成功 ${report.success} 个,失败 ${report.failed} 个`); }) .catch(error => { console.error('生成失败:', error); });

现代前端框架集成指南

React组件集成

创建可复用的React条形码组件:

import React, { useEffect, useRef } from 'react'; import JsBarcode from 'jsbarcode'; function BarcodeComponent({ value, format = "CODE128", width = 2, height = 100, displayValue = true, fontSize = 16, className = "", onValid = null }) { const barcodeRef = useRef(null); useEffect(() => { if (barcodeRef.current && value) { try { JsBarcode(barcodeRef.current, value, { format, width, height, displayValue, fontSize, valid: onValid }); } catch (error) { console.error('条形码生成失败:', error); } } }, [value, format, width, height, displayValue, fontSize, onValid]); return ( <div className={`barcode-container ${className}`}> <svg ref={barcodeRef} /> {!value && ( <div className="barcode-placeholder"> 请输入条形码内容 </div> )} </div> ); } // 使用示例 function ProductDisplay({ product }) { return ( <div className="product-card"> <h3>{product.name}</h3> <BarcodeComponent value={product.sku} format="EAN13" width={1.5} height={80} fontSize={14} onValid={(isValid) => { if (!isValid) { console.warn(`商品 ${product.name} 的SKU无效`); } }} /> <p>价格: ¥{product.price}</p> </div> ); }

Vue.js组件集成

创建Vue条形码组件:

<template> <div class="barcode-wrapper"> <svg ref="barcodeElement" v-if="value"></svg> <div v-else class="barcode-placeholder"> 等待条形码数据... </div> </div> </template> <script> import JsBarcode from 'jsbarcode'; export default { name: 'BarcodeGenerator', props: { value: { type: String, required: true }, format: { type: String, default: 'CODE128' }, width: { type: Number, default: 2 }, height: { type: Number, default: 100 }, displayValue: { type: Boolean, default: true }, fontSize: { type: Number, default: 16 } }, watch: { value(newValue) { this.generateBarcode(); }, format() { this.generateBarcode(); }, width() { this.generateBarcode(); }, height() { this.generateBarcode(); } }, mounted() { this.generateBarcode(); }, methods: { generateBarcode() { if (this.value && this.$refs.barcodeElement) { try { JsBarcode(this.$refs.barcodeElement, this.value, { format: this.format, width: this.width, height: this.height, displayValue: this.displayValue, fontSize: this.fontSize, valid: (isValid) => { this.$emit('validated', isValid); } }); } catch (error) { console.error('条形码生成失败:', error); this.$emit('error', error); } } } } } </script> <style scoped> .barcode-wrapper { display: inline-block; margin: 10px; } .barcode-placeholder { width: 200px; height: 100px; border: 2px dashed #ccc; display: flex; align-items: center; justify-content: center; color: #999; font-size: 14px; } </style>

性能优化与最佳实践

1. 缓存策略优化

对于频繁生成的条形码,使用缓存提高性能:

class BarcodeCache { constructor(maxSize = 100) { this.cache = new Map(); this.maxSize = maxSize; this.accessOrder = []; } get(key) { if (this.cache.has(key)) { // 更新访问顺序 const index = this.accessOrder.indexOf(key); this.accessOrder.splice(index, 1); this.accessOrder.push(key); return this.cache.get(key); } return null; } set(key, value) { // 如果缓存已满,移除最久未使用的 if (this.cache.size >= this.maxSize) { const oldestKey = this.accessOrder.shift(); this.cache.delete(oldestKey); } this.cache.set(key, value); this.accessOrder.push(key); } clear() { this.cache.clear(); this.accessOrder = []; } } // 使用缓存的条形码生成器 class OptimizedBarcodeGenerator { constructor() { this.cache = new BarcodeCache(50); this.canvas = document.createElement('canvas'); } generateBarcode(value, options = {}) { const cacheKey = this.generateCacheKey(value, options); // 检查缓存 const cached = this.cache.get(cacheKey); if (cached) { return cached; } // 生成新的条形码 JsBarcode(this.canvas, value, options); const dataUrl = this.canvas.toDataURL('image/png'); // 存入缓存 this.cache.set(cacheKey, dataUrl); return dataUrl; } generateCacheKey(value, options) { return `${value}-${JSON.stringify(options)}`; } }

2. 批量生成优化

使用Web Worker进行后台批量生成:

// 主线程代码 class BarcodeWorkerManager { constructor() { this.worker = new Worker('barcode-worker.js'); this.callbacks = new Map(); this.requestId = 0; this.worker.onmessage = (event) => { const { id, result, error } = event.data; const callback = this.callbacks.get(id); if (callback) { if (error) { callback.reject(error); } else { callback.resolve(result); } this.callbacks.delete(id); } }; } generateBarcode(value, options) { return new Promise((resolve, reject) => { const id = ++this.requestId; this.callbacks.set(id, { resolve, reject }); this.worker.postMessage({ id, type: 'generate', value, options }); }); } batchGenerate(items) { return new Promise((resolve, reject) => { const id = ++this.requestId; this.callbacks.set(id, { resolve, reject }); this.worker.postMessage({ id, type: 'batch', items }); }); } } // Web Worker代码 (barcode-worker.js) self.importScripts('jsbarcode.min.js'); self.onmessage = function(event) { const { id, type, value, options, items } = event.data; try { if (type === 'generate') { const canvas = new OffscreenCanvas(300, 150); JsBarcode(canvas, value, options); const imageBitmap = canvas.transferToImageBitmap(); self.postMessage({ id, result: imageBitmap }, [imageBitmap]); } else if (type === 'batch') { const results = items.map(item => { const canvas = new OffscreenCanvas(300, 150); JsBarcode(canvas, item.value, item.options); return canvas.transferToImageBitmap(); }); self.postMessage({ id, result: results }, results); } } catch (error) { self.postMessage({ id, error: error.message }); } };

错误处理与调试技巧

1. 输入验证与错误处理

function safeGenerateBarcode(elementSelector, value, options = {}) { try { // 基本验证 if (!value || value.trim() === '') { throw new Error('条形码内容不能为空'); } if (!elementSelector) { throw new Error('请指定条形码容器'); } const element = document.querySelector(elementSelector); if (!element) { throw new Error(`找不到元素: ${elementSelector}`); } // 默认配置 const defaultOptions = { format: 'auto', width: 2, height: 100, displayValue: true, fontSize: 16, lineColor: '#000000', background: '#ffffff' }; // 合并配置 const finalOptions = { ...defaultOptions, ...options }; // 生成条形码 JsBarcode(element, value, { ...finalOptions, valid: function(isValid) { if (!isValid) { console.warn(`条形码值 "${value}" 对于格式 "${finalOptions.format}" 可能无效`); // 可以触发自定义事件 const event = new CustomEvent('barcode-invalid', { detail: { value, format: finalOptions.format } }); element.dispatchEvent(event); } } }); return { success: true, element, value, options: finalOptions }; } catch (error) { console.error('条形码生成失败:', error.message); // 显示错误信息 const errorElement = document.querySelector(elementSelector); if (errorElement) { errorElement.innerHTML = ` <div style=" border: 2px dashed #ff6b6b; padding: 20px; text-align: center; color: #ff6b6b; background: #fff5f5; border-radius: 4px; "> <strong>条形码生成失败</strong><br> ${error.message} </div> `; } return { success: false, error: error.message }; } }

2. 调试与监控

class BarcodeDebugger { constructor() { this.stats = { totalGenerations: 0, successfulGenerations: 0, failedGenerations: 0, cacheHits: 0, cacheMisses: 0, generationTimes: [] }; } generateWithDebug(element, value, options) { const startTime = performance.now(); this.stats.totalGenerations++; try { JsBarcode(element, value, { ...options, valid: (isValid) => { const endTime = performance.now(); const generationTime = endTime - startTime; this.stats.generationTimes.push(generationTime); if (isValid) { this.stats.successfulGenerations++; console.log(`✅ 条形码生成成功 - 耗时: ${generationTime.toFixed(2)}ms`); } else { this.stats.failedGenerations++; console.warn(`⚠️ 条形码验证失败 - 值: ${value}, 格式: ${options.format}`); } } }); return true; } catch (error) { this.stats.failedGenerations++; console.error(`❌ 条形码生成错误:`, error.message); return false; } } getPerformanceReport() { const avgTime = this.stats.generationTimes.length > 0 ? this.stats.generationTimes.reduce((a, b) => a + b, 0) / this.stats.generationTimes.length : 0; return { ...this.stats, averageGenerationTime: avgTime.toFixed(2) + 'ms', successRate: this.stats.totalGenerations > 0 ? ((this.stats.successfulGenerations / this.stats.totalGenerations) * 100).toFixed(2) + '%' : '0%' }; } resetStats() { this.stats = { totalGenerations: 0, successfulGenerations: 0, failedGenerations: 0, cacheHits: 0, cacheMisses: 0, generationTimes: [] }; } }

项目架构与核心模块解析

源码结构概览

JsBarcode采用模块化设计,主要源码结构如下:

src/ ├── JsBarcode.js # 主入口文件 ├── barcodes/ # 条形码编码器 │ ├── CODE128/ # CODE128系列编码 │ ├── EAN_UPC/ # EAN/UPC编码 │ ├── CODE39/ # CODE39编码 │ ├── ITF/ # ITF编码 │ ├── MSI/ # MSI编码 │ ├── codabar/ # Codabar编码 │ ├── pharmacode/ # Pharmacode编码 │ └── Barcode.js # 条形码基类 ├── renderers/ # 渲染器 │ ├── canvas.js # Canvas渲染器 │ ├── svg.js # SVG渲染器 │ ├── object.js # 对象渲染器 │ └── shared.js # 共享渲染逻辑 ├── help/ # 辅助函数 │ ├── fixOptions.js # 选项修复 │ ├── getOptionsFromElement.js # 从元素获取选项 │ ├── linearizeEncodings.js # 编码线性化 │ └── merge.js # 对象合并 ├── exceptions/ # 异常处理 │ ├── ErrorHandler.js # 错误处理器 │ └── exceptions.js # 异常定义 └── options/ # 配置选项 └── defaults.js # 默认配置

核心编码器实现

每个条形码格式都有独立的编码器实现,以CODE128为例:

// 查看CODE128编码器实现 // src/barcodes/CODE128/CODE128.js // src/barcodes/CODE128/constants.js // 编码器基类定义 // src/barcodes/Barcode.js

渲染器架构

JsBarcode支持多种渲染方式,核心渲染逻辑:

// 查看渲染器实现 // src/renderers/shared.js - 共享渲染逻辑 // src/renderers/canvas.js - Canvas渲染实现 // src/renderers/svg.js - SVG渲染实现

常见问题与解决方案

Q1: 条形码扫描器无法识别生成的条形码?

解决方案:

  1. 确保使用正确的条形码格式
  2. 检查条形码尺寸和边距设置
  3. 验证条形码值是否符合格式规范
  4. 测试不同扫描设备兼容性
// 验证条形码格式 function validateBarcodeFormat(value, format) { const validators = { EAN13: /^\d{13}$/, EAN8: /^\d{8}$/, CODE128: /^[\x00-\x7F\xC8-\xD3]+$/, CODE39: /^[A-Z0-9\-\.\ \$\/\+\%]+$/i }; if (validators[format]) { return validators[format].test(value); } return true; // 未知格式默认通过 }

Q2: 如何在移动端获得最佳显示效果?

解决方案:

  1. 使用响应式尺寸
  2. 考虑Retina屏幕优化
  3. 确保足够的对比度
function generateMobileBarcode(elementId, value) { const isRetina = window.devicePixelRatio > 1; const baseWidth = isRetina ? 1 : 2; JsBarcode(`#${elementId}`, value, { format: "CODE128", width: baseWidth * (window.innerWidth / 400), // 响应式宽度 height: 80, displayValue: true, fontSize: 14, margin: 10, lineColor: "#000000", background: "#ffffff" }); }

Q3: 如何实现条形码的批量打印?

解决方案:

  1. 使用CSS媒体查询控制打印样式
  2. 批量生成后合并为PDF
  3. 使用专门的打印库
class BatchPrinter { constructor() { this.barcodes = []; } addBarcode(value, label, options = {}) { const canvas = document.createElement('canvas'); JsBarcode(canvas, value, { format: "CODE128", width: 2, height: 60, displayValue: true, text: label, fontSize: 12, ...options }); this.barcodes.push({ canvas, value, label, dataUrl: canvas.toDataURL('image/png') }); } print() { const printWindow = window.open('', '_blank'); printWindow.document.write(` <!DOCTYPE html> <html> <head> <title>条形码打印</title> <style> @media print { body { margin: 0; padding: 0; } .barcode-item { display: inline-block; margin: 10px; page-break-inside: avoid; } .barcode-label { text-align: center; font-size: 12px; margin-top: 5px; } } </style> </head> <body> ${this.barcodes.map((barcode, index) => ` <div class="barcode-item"> <img src="${barcode.dataUrl}" alt="条形码 ${barcode.label}"> <div class="barcode-label">${barcode.label}</div> </div> ${(index + 1) % 4 === 0 ? '<div style="clear: both;"></div>' : ''} `).join('')} </body> </html> `); printWindow.document.close(); printWindow.focus(); printWindow.print(); } }

开始使用JsBarcode

获取项目源码

git clone https://gitcode.com/gh_mirrors/js/JsBarcode cd JsBarcode npm install npm run build

探索核心源码

  • 主入口文件:src/JsBarcode.js
  • 条形码编码器:src/barcodes/
  • 渲染器实现:src/renderers/
  • 示例代码:example/
  • 测试用例:test/

运行测试

# 运行所有测试 npm test # 运行特定测试 npm test -- test/node/JsBarcode.test.js

构建项目

# 开发构建 npm run build # 查看构建结果 ls dist/

JsBarcode作为一个成熟稳定的条形码生成库,已经在众多生产环境中得到验证。无论是简单的商品标签生成,还是复杂的物流管理系统,JsBarcode都能提供可靠、高效的条形码生成解决方案。其零依赖设计、丰富的格式支持和灵活的配置选项,使其成为JavaScript生态系统中条形码生成的首选工具。

通过本文的介绍,你应该已经掌握了JsBarcode的核心概念、基本用法和高级技巧。现在就开始在你的项目中集成JsBarcode,享受高效、便捷的条形码生成体验吧!

【免费下载链接】JsBarcodeBarcode generation library written in JavaScript that works in both the browser and on Node.js项目地址: https://gitcode.com/gh_mirrors/js/JsBarcode

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/7/18 20:24:04

AI 本地部署中的 ollama 是什么?一文带你搞懂!!!

前言 Ollama 是一个开源工具&#xff0c;专为在本地计算机上高效运行大型语言模型&#xff08;LLM&#xff0c;如 deepseek-r1、qwen2.5 等&#xff09;而设计。它简化了模型的下载、部署和管理流程&#xff0c;让用户无需复杂配置即可在本地体验和开发基于大语言模型的应用。…

作者头像 李华
网站建设 2026/7/18 20:20:25

网络聊天助手2.0可以快捷回复预制好的话术所发的内容软件

大家好&#xff0c;我是大飞哥。平时做客服、搞销售或者在网上跟人聊天的时候&#xff0c;你是不是也经常遇到这种情况&#xff1a;客户问的问题翻来覆去就那么几个&#xff0c;每次都得重新打字回复&#xff0c;一天下来光重复打字就浪费好几个小时&#xff1b;有时候正聊着&a…

作者头像 李华
网站建设 2026/7/18 20:19:47

MyBatis 基础CRUD全套实战学习笔记

前言MyBatis 是后端开发主流持久层框架&#xff0c;用来简化 JDBC 数据库操作&#xff0c;不用手写繁琐的连接、释放资源代码。本文按课程分段完整梳理 MyBatis 基础增删改查全套操作&#xff0c;从环境搭建到条件查询全覆盖&#xff0c;适合零基础入门复习。一、Day09-01 MyBa…

作者头像 李华
网站建设 2026/7/18 20:19:24

AI_Coding: Hooks

1. 一句话理解 Hooks Codex Hooks 是插入到 Codex 生命周期中的脚本回调机制&#xff1a;当会话开始、用户提交提示词、工具执行前后、申请权限、上下文压缩或任务准备结束时&#xff0c;Codex 可以自动执行指定脚本。 Hooks 更适合做“必须执行的机械动作”&#xff0c;例如…

作者头像 李华
网站建设 2026/7/18 20:17:34

2026新款爆款蓝牙耳机怎么选不踩坑?五款在售机型实测对比

每年618和双十一前后&#xff0c;总有人问我"200块以内有没有靠谱的降噪耳机"。说实话&#xff0c;2026年入耳式蓝牙耳机市场已经卷得很细了&#xff0c;2026新款爆款蓝牙耳机在百元价位就能买到带ANC主动降噪和ENC通话降噪的型号。但参数看着都差不多&#xff0c;戴…

作者头像 李华