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

网站建设公司怎么推广房地产开发公司属于什么行业类别

网站建设公司怎么推广,房地产开发公司属于什么行业类别,鞍山高新区网站,上海好公司排名前十在这篇博客中#xff0c;我将分享如何用 Vue 3 和 TypeScript 实现一个带打字效果的 AI 分析展示组件。该组件具有如下功能#xff1a; 动态打字效果#xff1a;模拟打字机逐步显示内容。自动滚动#xff1a;内容超出容器高度时自动滚动到最新位置。 1. 组件实现需求 我…在这篇博客中我将分享如何用 Vue 3 和 TypeScript 实现一个带打字效果的 AI 分析展示组件。该组件具有如下功能 动态打字效果模拟打字机逐步显示内容。自动滚动内容超出容器高度时自动滚动到最新位置。 1. 组件实现需求 我们需要实现一个点击触发获取 AI 分析结果的功能并动态显示该分析内容同时实现以下功能 打字效果AI 分析内容逐字展示模仿打字机效果。自动滚动内容过长时滚动条自动跟随展示最新的内容。 2. 组件功能分析 (1) 打字效果的实现 我们将 AI 分析结果通过定时器逐步显示模拟打字机效果。每次定时器触发时向内容中添加一批字符。 3. 代码实现 模板部分 在模板部分我们定义了一个包含标题和内容的组件。点击标题后触发获取 AI 分析结果并以打字效果显示内容。加载状态用 Element Plus 提供的 Loading 图标进行展示 templatediv classm_ai_analysis_title clickfetchAiAnalysisspan classiconfont icon-ai_icon m_ai_icon/spanh3{{ title }}/h3el-icon v-ifaiLoading classis-loadingLoading //el-icon/divdiv classm_ai_analysis v-ifprintedContentdiv classcontent-container refcontentContainerdiv classtyping-effect v-htmlprintedContent/div/div/div /template样式部分 为了实现打字机的视觉效果我们通过 CSS 制作了光标闪烁效果并设置了内容容器的滚动条样式 .m_ai_analysis {padding: 12px 16px;border-top: 1px solid #eaeaea;background-color: #f9f9f9;border-radius: 8px; }.m_ai_analysis_title {margin-top: 20px;display: flex;align-items: center;gap: 6px;cursor: pointer; }.m_ai_analysis_title:hover .m_ai_icon {color: var(--el-color-primary);transform: scale(1.28);opacity: 0.88; }h3 {font-size: 16px;font-weight: bold; }.m_ai_icon {font-size: 28px;color: var(--el-color-primary);transition: all 0.3s ease; }.m_ai_icon.disabled {cursor: not-allowed;color: #ccc; }.content-container {max-height: 400px;overflow-y: auto; }.typing-effect {white-space: pre-wrap;display: inline-block;position: relative; }.typing-effect::after {content: |;position: relative;font-size: 1.2em;color: black;animation: blink 1s step-end infinite; }keyframes blink {0%, 100% {opacity: 1;}50% {opacity: 0;} } 核心逻辑部分 在 script 部分我们使用 Vue 3 的 Composition API 和 TypeScript 来定义组件的核心功能 script setup langts import commonApi from /api/commonApi; import { Loading } from element-plus/icons-vue; import { ref, watch, nextTick, onBeforeUnmount } from vue;const props defineProps{title: string;questionId: string | number | null; }();const printedContent ref(); // 打印内容 const aiLoading ref(false); // 加载状态 const contentContainer refHTMLElement | null(null); // 滚动容器 let intervalId: ReturnTypetypeof setInterval | null null; // 记录 intervalId// 监听 questionId 变化清空内容 watch(() props.questionId, async () {printedContent.value ; });// 获取 AI 分析结果 const fetchAiAnalysis async () {if (!props.questionId) return;aiLoading.value true;printedContent.value ;try {const { data } await commonApi.getGptAnalysis({ questionId: props.questionId });if (data) {await typeContent(data);}} catch (error) {console.error(Error fetching AI analysis:, error);} finally {aiLoading.value false;} };// 打字效果实现 const typeContent async (content: string) {let index 0;const batchSize 5; // 每次显示的字符数量intervalId setInterval(async () {if (index content.length) {const nextChunk content.slice(index, index batchSize);printedContent.value nextChunk;index batchSize;await nextTick();scrollToBottom();} else {clearInterval(intervalId!);}}, 100); };// 自动滚动到容器底部 const scrollToBottom () {if (contentContainer.value) {requestAnimationFrame(() {contentContainer.value!.scrollTop contentContainer.value!.scrollHeight;});} };// 清理定时器 onBeforeUnmount(() {if (intervalId) {clearInterval(intervalId);} }); /script4. 关键技术点解析 (1) 打字效果 使用 setInterval 每隔一定时间添加一部分字符直到整个内容被打印完成。这种方式模拟了一个打字机的效果用户可以逐步看到分析内容的生成过程。 (2) 滚动到最新内容 通过 requestAnimationFrame 实现平滑的滚动效果使得当新内容被添加时页面自动滚动到底部保持用户可以看到最新的内容。 效果图 5. 总结 本文分享了如何在 Vue 3 和 TypeScript 项目中实现一个带打字效果的 AI 分析展示组件。
http://www.dnsts.com.cn/news/118418.html

相关文章:

  • 建设岗位考试网站建设工程施工合同条例
  • 网站建设说明书资讯类网站源码
  • 网站搭建软件网站建设 书
  • dede 网站地图衡水学校网站建设
  • 如何做像淘宝一样的网站工商注册公司查名
  • 土特产网站建设状况竞价推广遇到恶意点击怎么办
  • 制作网站源码软件微信房地产网站建设
  • 庐江县住房和城乡建设局网站个人网站建设方案模板
  • 网站开发哈尔滨网站开发公司理财网站如何做推广
  • 深圳白帽优化西安网站优化指导
  • 网站建设项目报价单网站建设费 什么科目
  • 中文域名可以做网站吗saharan wordpress
  • 网站建设维护工作网站建设中目录是什么意思
  • 备案的时候需要网站吗网站被域名重定向
  • html5手机网站教程重庆做企业年报在哪个网站做
  • 怎么做网站演示h5制作免费素材
  • 关于网站建设的外文翻译宁夏建设工程交易中心网站
  • 网站可兼容移动端做网站用什么软件编辑
  • 互联网网站建设挣钱吗wordpress更新需要连接ftp
  • 高校健康驿站建设指引淮上网站建设
  • 广州公司网站制作公司深圳网站建设公司官网
  • 免费网站电视剧下载石家庄做建站模板
  • 商城网站建设哪家效益快网站式登录页面模板下载
  • 网站设计项目书网站qq访客记录原理
  • 个人微信号做网站行吗wordpress vpn
  • 网站手机缩放扬州网站建设电话
  • 怎样创建网站以及建站流程是什么织梦手机网站有广告位
  • 广东省特色专业建设网站建设银行e路通网网站
  • 浩博建设集团网站单位网站建设要记入无形资产吗
  • 网站建设公司的出路wordpress wap版