vue3實現實現手機/PC端錄音:recorder-core

在這里插入圖片描述

通過 recorder-core 這個插件實現錄音

recorder-core插件使用

下方的js文件是安裝后封裝的一個js文件,在需要使用的地方直接引入這個文件:import record from “./recorderCore.js”;

//  文件名稱:recorderCore.js// recorder-core插件使用方式:https://huaweicloud.csdn.net/6549fb3434bf9e25c799ca07.html?dp_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MTI5NDc5OSwiZXhwIjoxNzUzOTM3ODg5LCJpYXQiOjE3NTMzMzMwODksInVzZXJuYW1lIjoic2lzdWliYW4ifQ.Y2_R3XsABjzRvhML0rdYMuGJhYrIDM-rrPob4RDJtro&spm=1001.2101.3001.6650.6&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Eactivity-6-131902136-blog-147322532.235%5Ev43%5Econtrol&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Eactivity-6-131902136-blog-147322532.235%5Ev43%5Econtrol&utm_relevant_index=13
// 例子 https://blog.csdn.net/weixin_47137972/article/details/147322532?ops_request_misc=%257B%2522request%255Fid%2522%253A%25226a538d344bc89fef66029e7d7a2a0b06%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=6a538d344bc89fef66029e7d7a2a0b06&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~sobaiduend~default-1-147322532-null-null.nonecase&utm_term=vue%E5%AE%9E%E7%8E%B0%E5%BD%95%E9%9F%B3%E5%8A%9F%E8%83%BD&spm=1018.2226.3001.4450
//必須引入的核心
import Recorder from 'recorder-core';//引入mp3格式支持文件;如果需要多個格式支持,把這些格式的編碼引擎js文件放到后面統統引入進來即可
import 'recorder-core/src/engine/mp3';
import 'recorder-core/src/engine/mp3-engine';
//錄制wav格式的用這一句就行
import 'recorder-core/src/engine/wav';const record = {RecordApp: null,recBlob: null,/**麥克風授權 */getPermission: (fn) => {const newRec = Recorder({type: 'wav',bitRate: 16,sampleRate: 16000, //阿里采樣率16000onProcess: function (buffers, powerLevel, duration, bufferSampleRate) {// console.log(buffers);},});//打開錄音,獲得權限newRec.open(() => {record.RecordApp = newRec;fn({ status: 'success', data: '開啟成功' });},(msg, isUserNotAllow) => {//用戶拒絕了錄音權限,或者瀏覽器不支持錄音fn({ status: 'fail', data: msg });// console.log((isUserNotAllow ? 'UserNotAllow,' : '') + '無法錄音:' + msg);});},/**開始錄音 */startRecorder: () => {if (record.RecordApp && Recorder.IsOpen()) {record.RecordApp.start();}},/** 停止錄音 */stopRecorder: (fn) => {try {if (!record) {// console.error('未打開錄音');return;}record.RecordApp.stop((blob, duration) => {// console.log('錄音成功', blob, '時長:' + duration + 'ms');if (blob) {record.recBlob = blob;const url = URL.createObjectURL(blob);const formData = new FormData();formData.append('audio', blob);fn({ loading: true }, url, blob);}/* eslint-enable */record.RecordApp.close();record.RecordApp = null;});} catch (err) {fn({ err: err });// console.error('結束錄音出錯:' + err);record.RecordApp.close();record.RecordApp = null;}},/**關閉錄音,釋放麥克風資源 */destroyRecorder: () => {if (record.RecordApp) {record.RecordApp.close();record.RecordApp = null;}},/**暫停 */pauseRecorder: () => {if (record.RecordApp) {record.RecordApp.pause();}},/**恢復繼續錄音 */resumeRecorder: () => {if (record.RecordApp) {record.RecordApp.resume();}},
};export default record;

接下來就是使用上方的js文件

import record from "./config/recorderCore.js";// 點擊了開始錄音按鈕
const onclick_luyin = () => {record.getPermission(function (permiss) {if (permiss.status == "fail") {ElMessage.error(permiss.data); //這里直接寫一個報錯提示,我這用的是elementUI的} else {record.startRecorder(); //開始錄音}});
};
// 錄音停止按鈕
const onclick_guanbi = () => {record.stopRecorder((res, url, blob) => {if (blob && blob.size) {console.log("文件大小:", blob.size);// 調用語音轉文字的接口AudioToText(blob);}});
};
// 語音轉文字
const AudioToText = async (file) => {const maxSize = 14 * 1024 * 1024; // 14MBif (file.size > maxSize) {ElMessage.error("語音文件的大小超過14MB,請重新錄音");return;}const baseurl = `${DEEPSEEK_CONFIG.baseURL}/audio-to-text`;const apiKey = `${DEEPSEEK_CONFIG.apiKey}`;// 強制指定 MIME 為 audio/mp3const newFile = new File([file], "語音", { type: "audio/mp3" });const formData = new FormData();formData.append("file", newFile);try {const response = await fetch(baseurl, {method: "POST",headers: {Authorization: `Bearer ${apiKey}`,},body: formData,});const text = await response.text();try {const data = JSON.parse(text);if (response.ok) {queryKeys.value = data.text;} else {queryKeys.value = "";ElMessage.error(`語音轉文字接口錯誤:${JSON.stringify(data)}`);}} catch {queryKeys.value = "";ElMessage.error(`語音轉文字接口響應不是 JSON:${text}`);}} catch (error) {queryKeys.value = "";ElMessage.error(`語音轉文字接口請求異常:${error.message}`);}
};

提供一個vue錄音動畫組件

<template><transition name="modal-fade"><div v-if="isOpen" class="modal-overlay" @click="handleOverlayClick"><!-- 科技感網格背景 --><div class="tech-grid"></div><!-- 掃描線效果 --><div class="scan-line" :class="{ active: props.isOpen }"></div><div class="modal-container"><!-- 裝飾性光效 --><div class="glow-effect top"></div><div class="glow-effect bottom"></div><div class="audio-animation-container"><!-- 高科技風格波形容器 --><div class="wave-container"><divv-for="(bar, index) in bars":key="index"class="wave-bar":style="{height: bar.height,background: bar.gradient,boxShadow: bar.glow,transitionDelay: `${bar.delay}ms`,transform: `scaleX(${bar.scale})`}"></div><!-- 倒計時顯示 - 現在位于波形中央 --><div class="countdown-display"><span class="countdown-number">{{ countdown }} / 60</span></div></div></div><!-- 狀態指示器 --><div class="status-indicator"><div class="pulse-dot"></div><span style="color:#fff">可以開始講話了,總共能講60秒</span></div></div></div></transition>
</template><script setup>
import { ref, onBeforeUnmount, watch, onUnmounted } from "vue";const props = defineProps({isOpen: {type: Boolean,required: true,},// 科技感主色調primaryColor: {type: String,default: '#fff'},// 動畫速度(毫秒)speed: {type: Number,default: 80},// 波形條數量barCount: {type: Number,default: 40, // 更多的波形條增強科技感validator: (value) => value >= 20 && value <= 40},// 最大高度比例maxHeightRatio: {type: Number,default: 85,validator: (value) => value >= 70 && value <= 100}
});const emit = defineEmits(["close"]);// 倒計時相關
const countdown = ref(0);
let countdownTimer = null;// 關閉模態框
const closeModal = () => {stopAnimation();stopCountdown();emit("close");
};// 點擊遮罩關閉
const handleOverlayClick = () => {closeModal();
};// 生成科技感漸變色
const generateGradient = (index) => {// 基于位置生成微妙的色調變化const hueOffset = (index % 10) * 3;const baseColor = props.primaryColor;const lightColor = shadeColor(baseColor, 30);return `linear-gradient(180deg, ${lightColor} 0%, ${baseColor} 70%)`;
};// 調整顏色明暗度
const shadeColor = (color, percent) => {let R = parseInt(color.substring(1, 3), 16);let G = parseInt(color.substring(3, 5), 16);let B = parseInt(color.substring(5, 7), 16);R = parseInt(R * (100 + percent) / 100);G = parseInt(G * (100 + percent) / 100);B = parseInt(B * (100 + percent) / 100);R = (R < 255) ? R : 255;G = (G < 255) ? G : 255;B = (B < 255) ? B : 255;R = Math.round(R);G = Math.round(G);B = Math.round(B);const RR = ((R.toString(16).length === 1) ? "0" + R.toString(16) : R.toString(16));const GG = ((G.toString(16).length === 1) ? "0" + G.toString(16) : G.toString(16));const BB = ((B.toString(16).length === 1) ? "0" + B.toString(16) : B.toString(16));return `#${RR}${GG}${BB}`;
};// 波形數據數組
const bars = ref([]);
// 初始化波形數據
for (let i = 0; i < props.barCount; i++) {const color = generateGradient(i);const glowColor = shadeColor(props.primaryColor, 50);bars.value.push({height: '5%',gradient: color,glow: `0 0 8px ${glowColor}, 0 0 12px ${glowColor}33`,delay: calculateDelay(i, props.barCount),scale: 1});
}// 計算每個波形條的動畫延遲,創建同步波動效果
function calculateDelay(index, total) {// 創造波浪式延遲模式,增強科技感return (index % 5) * 40;
}// 動畫定時器
let animationTimer = null;
let pulseTimer = null;// 生成更有規律的波形高度,符合高科技感
const generateHeights = () => {const newBars = [...bars.value];const maxHeight = props.isOpen ? props.maxHeightRatio : 10;const minHeight = props.isOpen ? 5 : 3;// 創建更有規律的波形模式,類似音頻頻譜const time = Date.now() / 500;newBars.forEach((bar, index) => {// 使用正弦函數創建更流暢的波形const frequency = 0.5 + (index / newBars.length) * 2;const amplitude = props.isOpen ? 0.5 + Math.random() * 0.5 : 0.2;const baseHeight = (maxHeight - minHeight) * 0.5 + minHeight;const wave = Math.sin(time * frequency + (index * 0.3)) * amplitude;const height = Math.floor(baseHeight * (1 + wave));// 添加微妙的縮放效果const scale = props.isOpen ? 1 + (wave * 0.1) : 1;newBars[index] = {...bar,height: `${height}%`,scale: scale,gradient: generateGradient(index)};});bars.value = newBars;
};// 啟動動畫
const startAnimation = () => {if (animationTimer) clearInterval(animationTimer);if (pulseTimer) clearInterval(pulseTimer);generateHeights();animationTimer = setInterval(generateHeights, props.speed);// 啟動脈沖效果pulseTimer = setInterval(() => {const glowElements = document.querySelectorAll('.glow-effect');glowElements.forEach(el => {el.classList.add('pulse');setTimeout(() => el.classList.remove('pulse'), 500);});}, 2000);
};// 停止動畫并重置
const stopAnimation = () => {if (animationTimer) {clearInterval(animationTimer);animationTimer = null;}if (pulseTimer) {clearInterval(pulseTimer);pulseTimer = null;}// 平滑重置為低波形const newBars = [...bars.value].map(bar => ({...bar,height: '5%',scale: 1}));bars.value = newBars;
};// 啟動倒計時
const startCountdown = () => {// 重置倒計時countdown.value = 0;// 清除現有定時器if (countdownTimer) {clearInterval(countdownTimer);}// 設置新定時器countdownTimer = setInterval(() => {countdown.value++;// 當倒計時達到60時關閉模態框if (countdown.value >= 60) {handleOverlayClick();}}, 1000);
};// 停止倒計時
const stopCountdown = () => {if (countdownTimer) {clearInterval(countdownTimer);countdownTimer = null;}
};// 監聽isOpen狀態變化,控制動畫和倒計時
watch(() => props.isOpen,(newVal) => {if (newVal) {startAnimation();startCountdown();} else {stopCountdown();}},{ immediate: true }
);// 監聽顏色變化
watch(() => props.primaryColor,(newVal) => {const updatedBars = [...bars.value].map((bar, index) => {const color = generateGradient(index);const glowColor = shadeColor(newVal, 50);return {...bar,gradient: color,glow: `0 0 8px ${glowColor}, 0 0 12px ${glowColor}33`};});bars.value = updatedBars;}
);// 組件卸載時清理
onBeforeUnmount(() => {stopAnimation();stopCountdown();
});onUnmounted(() => {if (animationTimer) clearInterval(animationTimer);if (pulseTimer) clearInterval(pulseTimer);if (countdownTimer) clearInterval(countdownTimer);
});
</script><style scoped>
/* 高科技風格配色方案 */
:root {--tech-blue: #00e5ff;--tech-dark: #0a1929;--tech-darker: #050f1a;--tech-light: #64ffda;--glow: 0 0 10px var(--tech-blue), 0 0 20px rgba(0, 229, 255, 0.3);--glow-strong: 0 0 15px var(--tech-blue), 0 0 30px rgba(0, 229, 255, 0.5);--transition-fast: all 0.1s ease-out;--transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}.modal-overlay {position: fixed;left: 0;right: 0;bottom: 200px;display: flex;justify-content: center;align-items: center;z-index: 1000;height: 200px;overflow: hidden;
}/* 科技感網格背景 */
.tech-grid {position: absolute;top: 0;left: 0;right: 0;bottom: 0;background-image: linear-gradient(rgba(0, 229, 255, 0.1) 1px, transparent 1px),linear-gradient(90deg, rgba(0, 229, 255, 0.1) 1px, transparent 1px);background-size: 20px 20px;z-index: -1;animation: gridMove 8s linear infinite;
}/* 掃描線效果 */
.scan-line {position: absolute;top: -5%;left: 0;right: 0;height: 2px;background: linear-gradient(90deg, transparent, var(--tech-blue), transparent);opacity: 0.3;z-index: 1;transition: opacity 0.5s ease;
}.scan-line.active {opacity: 0.6;animation: scan 3s linear infinite;
}@keyframes scan {0% { top: -5%; }100% { top: 105%; }
}@keyframes gridMove {0% { background-position: 0 0; }100% { background-position: 20px 20px; }
}.modal-container {position: relative;background-color: var(--tech-dark);border: 1px solid rgba(0, 229, 255, 0.3);border-radius: 8px;backdrop-filter: blur(10px);box-shadow: var(--glow);width: 90%;max-width: 600px;padding: 20px;display: flex;flex-direction: column;align-items: center;overflow: hidden;
}/* 裝飾性光效 */
.glow-effect {position: absolute;left: 0;right: 0;height: 2px;background: linear-gradient(90deg, transparent, var(--tech-blue), transparent);opacity: 0.6;transition: var(--transition-slow);
}.glow-effect.top { top: 0; }
.glow-effect.bottom { bottom: 0; }.glow-effect.pulse {opacity: 1;box-shadow: var(--glow-strong);
}.audio-animation-container {display: flex;justify-content: center;align-items: center;width: 100%;height: 140px;
}.wave-container {display: flex;align-items: center;justify-content: center;gap: 2px; /* 更緊密的波形條 */width: 100%;height: 100%;position: relative; /* 新增:為了讓倒計時能絕對定位在波形內部 */
}.wave-bar {width: 3px; /* 更細的波形條 */border-radius: 1px;transition: var(--transition-fast);transform-origin: center bottom;
}/* 倒計時顯示樣式 - 現在位于波形中央 */
.countdown-display {position: absolute;display: flex;flex-direction: column;align-items: center;justify-content: center;color: var(--tech-blue);font-family: 'Courier New', monospace;z-index: 2; /* 確保在波形條上方顯示 */pointer-events: none; /* 允許點擊穿透到下方的波形 */
}.countdown-number {font-size: 24px;font-weight: 600;font-weight: bold;text-shadow: 0 0 8px var(--tech-blue), 0 0 12px rgba(0, 229, 255, 0.5);line-height: 1;
}.countdown-label {font-size: 10px;opacity: 0.8;margin-top: 2px;
}/* 狀態指示器 */
.status-indicator {display: flex;align-items: center;gap: 8px;margin-top: 10px;
}.status-indicator span {color: var(--tech-blue);font-family: 'Courier New', monospace;font-size: 11px;letter-spacing: 1px;opacity: 0.8;
}.pulse-dot {width: 6px;height: 6px;border-radius: 50%;background-color: #ff3e3e;animation: pulse 1.5s infinite;
}@keyframes pulse {0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 62, 62, 0.7); }70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(255, 62, 62, 0); }100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 62, 62, 0); }
}/* 過渡動畫 */
.modal-fade-enter-active,
.modal-fade-leave-active {transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}.modal-fade-enter-from {opacity: 0;transform: translateY(20px) scale(0.98);
}.modal-fade-leave-to {opacity: 0;transform: translateY(10px) scale(0.99);
}
</style>

組件使用:

<AudioWaveAnimation:isOpen="isRecording":primaryColor="getRandomShadow()"@close="onclick_guanbi"/>// js
import AudioWaveAnimation from "./component/AudioWaveAnimation.vue";// 組件的顯示與隱藏開關
const isRecording = ref(false);
// 生成隨機顏色
function getRandomShadow() {const hue = Math.floor(Math.random() * 360); // 色相(0-360)const saturation = Math.floor(Math.random() * 30) + 70; // 飽和度(70%-100%)const lightness = Math.floor(Math.random() * 20) + 60; // 明度(60%-80%)const alpha = 0.3 + Math.random() * 0.3; // 透明度(0.3-0.6)// 直接返回hsla顏色值return `hsla(${hue}, ${saturation}%, ${lightness}%, ${alpha})`;
}

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/94008.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/94008.shtml
英文地址,請注明出處:http://en.pswp.cn/web/94008.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

deepseek 本地部署,如何支持工具調用

這里需要考慮顯卡是否和模型匹配&#xff0c;支不支持推理 先把模版拉取到本地&#xff1a;git clone https://github.com/sgl-project/sglang.git 我的位置是 /data/home/sglang 注意模版位于sglang下的examples/chat_template中 根據對應的模版部署模型&#xff0c;比如 …

Excel中運行VB的函數

“插入” -》 “模塊”Function FormatCodeFlex(inputStr As String, Optional defaultVal As String "0") As StringOn Error GoTo ErrorHandlerDim parts() As StringDim i As Integer 使用 "-" 分割字符串parts Split(inputStr, "-") 確保至…

《零基礎入門AI:深度學習之NLP基礎學習》

一、自然語言處理&#xff08;NLP&#xff09;概述 1. 基本概念 ? 自然語言處理&#xff08;Natural Language Processing, NLP&#xff09;是人工智能與計算語言學交叉的核心領域&#xff0c;致力于實現計算機對人類自然語言的自動理解、分析、生成與交互。其研究目標在于構…

保姆級Debezium抽取SQL Server同步kafka

前言&#xff1a; Debezium SQL Server連接器捕獲SQL Server數據庫模式中發生的行級更改。 官方2.0文檔&#xff1a; Debezium connector for SQL Server :: Debezium Documentation 有關與此連接器兼容的SQL Server版本的信息&#xff0c;請參閱 SQL Server Database: 201…

鴻蒙安卓前端中加載丟幀:ArkWeb分析

序章&#xff1a;卡頓的數字世界 在每秒60幀的視覺交響樂中&#xff0c;每一幀都是精心編排的節拍。當這些節拍開始丟失——就像交響樂中突然靜音的提琴部——我們便遭遇了加載丟幀的數字噩夢。這不是簡單的性能下降&#xff0c;而是一場渲染管線的全面崩潰&#xff0c;是數字…

Spring Cloud Netflix學習筆記06-Zuul

文章目錄概述什么是Zuul?Zuul 能干嘛&#xff1f;Zuul入門案例pom依賴application.yml啟動類隱藏真實路徑概述 什么是Zuul? Zuul包含了對請求的路由(用來跳轉的)和過濾兩個最主要功能&#xff1a; 其中路由功能負責將外部請求轉發到具體的微服務實例上&#xff0c;是實現外…

c# 和 c++ 怎樣結合

c# 和 c 怎樣結合在軟件開發中&#xff0c;C# 和 C 通常用于不同的場景和目的&#xff0c;但有時需要將它們結合使用以充分利用兩種語言的優點。以下是幾種常見的方法來實現 C# 和 C 的結合&#xff1a;1. P/Invoke&#xff08;Platform Invocation Services&#xff09;P/Invo…

開源分布式數據庫(Dgraph)

Dgraph 是一款專為處理復雜關系數據設計的開源分布式圖數據庫&#xff0c;核心目標是提供高性能、高可擴展性的圖數據存儲與查詢能力。其設計融合了原生圖模型與分布式架構&#xff0c;支持 GraphQL 查詢語言&#xff0c;適用于社交網絡、知識圖譜、推薦系統等場景。 一、技術架…

Apache ShenYu和Nacos之間的通信原理

這是一個非常經典的服務注冊發現和動態配置管理的案例。ShenYu 作為網關,需要實時感知后端微服務的上線、下線以及其元數據信息(如 API 接口列表)的變化,同時它自身的配置也可能需要動態調整。Nacos 則作為注冊中心和配置中心,扮演了“服務電話簿”和“動態配置倉庫”的角…

強制重啟導致Ubuntu24.04LTS amd的WIFI無法使用的解決方案

強制重啟導致Ubuntu24.04LTS amd的WIFI無法使用的解決方案 前言 ? 我按下了<ctrl><alt><prtsc>組合鍵&#xff0c;然后按住<ctrl><alt>不放&#xff0c;讓我的死機的圖形化的Ubuntu強制重啟&#xff0c;然后再次打開發現&#xff0c;我的ubu…

Java基礎面試題02

引用&#xff1a;&#xff08;代碼隨想錄的八股轉免費了&#xff09;以下為網址 卡碼筆記 本文為學習以上文章的筆記&#xff0c;如果有時間推薦直接去原網址 Java中的數據類型有哪些&#xff1f;分為哪兩大類&#xff1f; (考點&#xff1a;Java數據類型及其分類) 【簡單】 基…

RabbitMQ:SpringAMQP Fanout Exchange(扇型交換機)

目錄一、案例需求二、基礎配置三、代碼實現扇形交換機也叫做廣播交換機&#xff0c;通過交換機將消息發送給所有的隊列。 生產者源碼 消費者源碼 一、案例需求 在RabbitMQ控制臺中&#xff0c;聲明隊列fanout.queue1和fanout.queue2。在RabbitMQ控制臺中&#xff0c;聲明交換…

深度解析DeepSeek V3.1 :6850 億參數開源模型如何以 71.6% 編碼得分、68 倍成本優勢重構全球 AI 競爭格局

深度解析DeepSeek V3.1 &#xff1a;6850 億參數開源模型如何以 71.6% 編碼得分、68 倍成本優勢重構全球 AI 競爭格局當DeepSeek悄然將其 6850 億參數的 V3.1 模型上傳至 Hugging Face 平臺時&#xff0c;這個看似低調的舉動卻在全球 AI 領域投下了一顆 “深水炸彈”。這款融合…

Java 大視界 -- Java 大數據在智能安防視頻監控系統中的視頻內容理解與智能預警升級(401)

Java 大視界 -- Java 大數據在智能安防視頻監控系統中的視頻內容理解與智能預警升級&#xff08;401&#xff09;引言&#xff1a;正文&#xff1a;一、傳統安防監控的 “三重困局”&#xff1a;看不全、看不懂、反應慢1.1 人工盯屏 “力不從心”1.1.1 攝像頭密度與人力的矛盾1…

ansible playbook 實戰案例roles | 實現基于node_exporter的節點部署

文章目錄一、核心功能描述二、roles內容2.1 文件結構2.2 主配置文件2.3 tasks文件內容2.4 vars文件內容免費個人運維知識庫&#xff0c;歡迎您的訂閱&#xff1a;literator_ray.flowus.cn 一、核心功能描述 這個 Ansible Role 的核心功能是&#xff1a;?自動化部署 Prometheu…

.NET Core MongoDB 查詢數據異常及解決

.NET Core 查詢 MongoDB異常消息Element _class does not match any field or property of class WebApiServer.Model.Enity.Ypxxx.圖中寫的修改實際是查詢分頁出現的異常&#xff0c;異常是查詢轉換為List<T>時出現的&#xff1a; 這個錯誤通常發生在MongoDB文檔中包含的…

政策技術雙輪驅動智慧燈桿市場擴容,塔能科技破解行業痛點

在新型城市基礎設施建設不斷加速&#xff0c;以及“雙碳”戰略持續深化這樣的雙重背景之下&#xff0c;智慧燈桿市場恰恰迎來了政策紅利得以釋放、技術出現迭代突破并且需求在持續升級的極為難得的黃金發展時期。智慧城市建設 的核心承載從國家層面所開展的全域智能化改造規劃&…

JetBrains Mono字體

好的,我們來詳細解析一下 JetBrains Mono 的 8 種主要字體風格(實際上官方提供了 9 種字重,但通常我們討論其核心風格)及其區別。 這些風格的區別主要體現在兩個方面:字重 和 字形。 核心區別:字重 字重就是字體的粗細程度。JetBrains Mono 提供了從細到極粗的多種選擇…

MySQL 分頁查詢:用 LIMIT 高效處理大量數據

MySQL 分頁查詢&#xff1a;用 LIMIT 高效處理大量數據 在實際開發中&#xff0c;當查詢結果包含成百上千條記錄時&#xff0c;一次性展示所有數據會導致加載緩慢、用戶體驗差。分頁查詢能將數據分段展示&#xff0c;既減輕服務器壓力&#xff0c;又方便用戶瀏覽。MySQL 中通過…

GraphQL 與 REST 在微服務架構中的對比與設計實踐

GraphQL 與 REST 在微服務架構中的對比與設計實踐 隨著微服務架構的普及&#xff0c;API 設計已經成為系統性能、可維護性和開發效率的關鍵。REST&#xff08;Representational State Transfer&#xff09;作為傳統的無狀態架構風格&#xff0c;擁有簡單、成熟的生態&#xff1…