基于vue3.5+vite7+element-plus网页聊天系统

简介: 最新版vite7.1+vue3.5+element-plus仿微信web网页版聊天vite7-webchat。

2025最新版原创vite7.1+vue3+pinia3+elementPlus网页端仿微信web聊天系统。

image.png

vite7-vue3-wechat基于vite7+vue3搭建仿微信界面网页端聊天模板。实现了聊天、联系人、收藏、朋友圈、小视频、我的等模块。


011360截图20250904000235421.png

p2.gif


运用技术

  • 技术框架:vite7.1+vue3.5+vue-router4.5+pinia3
  • 组件库:element-plus^2.11.1 (饿了么网页端vue3组件库)
  • 状态管理:pinia^3.0.3
  • 地图插件:@amap/amap-jsapi-loader(高德地图组件)
  • 视频滑动:swiper^11.2.10
  • 富文本编辑器:wangeditor^4.7.15
  • 样式编译:sass^1.91.0
  • 构建工具:vite^7.1.2


011360截图20250903235835045.png

011360截图20250903235921902.png


项目结构

使用全新的vite7构建项目,vue3 setup语法编码。


360截图20250905073642668.png


p3.gif

p5.gif


项目布局模板

8522f26c8d169758e689a61a24176462_1289798-20250905075343426-781125690.png

c9cea12d03898c2e38ee5205ebc9746b_1289798-20250905075435258-1414696640.png


<script setup>
  import { useRoute } from 'vue-router'
  import { appState } from '@/pinia/modules/app'

  import MenuBar from './components/menubar/index.vue'
  import SideBar from './components/sidebar/index.vue'
  import Winbtn from './components/winbtn.vue'

  const route = useRoute()
  const appstate = appState()
</script>

<template>
  <div class="vu__container" :class="{'fullscreen': appstate.config.fullscreen}" :style="{'--themeSkin': appstate.config.skin}">
    <div class="vu__layout flexbox flex-col">
      <div class="vu__layout-body flex1 flexbox" @contextmenu.prevent>
        <!-- 菜单栏 -->
        <slot v-if="!route?.meta?.hideMenuBar" name="menubar">
          <MenuBar />
        </slot>

        <!-- 侧边栏 -->
        <div v-if="route?.meta?.showSideBar" class="vu__layout-sidebar flexbox" :class="{'hidden': appstate.config.collapsed}">
          <aside class="vu__layout-sidebar__body flexbox flex-col">
            <slot name="sidebar">
              <SideBar />
            </slot>
          </aside>
        </div>

        <!-- 主内容区 -->
        <div class="vu__layout-main flex1 flexbox flex-col">
          <Winbtn v-if="!route?.meta?.hideWinBar" />
          <router-view v-slot="{ Component, route }">
            <keep-alive>
              <component :is="Component" :key="route.path" />
            </keep-alive>
          </router-view>
        </div>
      </div>
    </div>
  </div>
</template>

002360截图20250903225137409.png 002360截图20250903232544731.png 002360截图20250903232828291.png 003360截图20250903233033123.png 005360截图20250903233218652.png 005360截图20250903233712315.png


vue3-router路由配置

c11b6713ade8ed6868985306104d211e_1289798-20250905075648587-1173093368.png


import { createRouter, createWebHashHistory } from 'vue-router'
import { authState } from '@/pinia/modules/auth'

import Layout from '@/layouts/index.vue'

// 批量导入路由
const modules = import.meta.glob('./modules/*.js', { eager: true })
console.log(modules)
const patchRouters = Object.keys(modules).map(key => modules[key].default).flat()
console.log(patchRouters)

/**
 * meta配置
 * @param meta.requireAuth 需登录验证页面
 * @param meta.hideWinBar 隐藏右上角按钮组
 * @param meta.hideMenuBar 隐藏菜单栏
 * @param meta.showSideBar 显示侧边栏
 * @param meta.canGoBack 是否可回退上一页
 */
const routes = [
  ...patchRouters,
  // 错误模块
  {
    path: '/:pathMatch(.*)*',
    redirect: '/404',
    component: Layout,
    meta: {
      title: '404error',
      hideMenuBar: true,
      hideWinBar: true,
    },
    children: [
      {
        path: '404',
        component: () => import('@/views/error/404.vue'),
      }
    ]
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes,
})

// 全局路由钩子拦截
router.beforeEach((to, from) => {
  const authstate = authState()
  if(to?.meta?.requireAuth && !authstate.authorization) {
    return {
      path: '/login'
    }
  }
})

router.afterEach((to, from) => {
  // 阻止浏览器回退
  if(to?.meta?.canGoBack == false && from.path != null) {
    history.pushState(history.state, '', document.URL)
  }
})

router.onError(error => {
  console.warn('[Router Error]', error)
})

export default router

012360截图20250904001027805.png 013360截图20250904001118030.png 014360截图20250904001148829.png 015360截图20250904001225078.png


原创开发不易,感谢大家的阅读与支持。


目录
相关文章
|
3月前
|
数据采集 人工智能 监控
零代码改造!LoongSuite AI 采集套件观测实战
在 AI 时代,随着模型和应用侧的快速演化,对于推理过程,成本和性能显得尤为重要,而端到端的 AI 可观测是其中至关重要的一环。本文将介绍端到端 AI 可观测的基本概念与痛点,并通过阿里云可观测团队最新开源的 AI 采集套件 LoongSuite Agent 来对大模型应用进行全链路可观测以解决这些痛点。帮助客户无侵入,低成本地进行全链路的大模型可观测。
339 43
零代码改造!LoongSuite AI 采集套件观测实战
|
编解码 UED
媒体查询中 max-width 和 min-width 属性的作用
【10月更文挑战第24天】可以结合其他媒体特性,如高度、分辨率等,来进一步优化和定制媒体查询的效果。通过对这些属性的深入理解和灵活运用,我们能够更好地应对不同屏幕尺寸带来的挑战,打造出适应各种环境的优秀设计作品。
|
23天前
|
JSON 前端开发 开发工具
基于Tauri2.9+Vite7.2+Vue3+Pinia3+ArcoDesign+Echarts桌面版OS管理后台模板
基于最新跨平台框架tauri2.9+vite7.2.2+vue3 setup+pinia3+arco-design+echarts搭建桌面端OS管理后台模板。
119 4
|
2月前
|
前端开发 开发工具 iOS开发
原创Electron38.2+Vite7+Vue3+Pinia3+ArcoDesign客户端os管理系统模板
2025最新版原创研发Electron38.2+Vite7+Vue3 setup+ArcoDesign+Echarts仿MacOS/Wins风格桌面客户端OS系统解决方案。
177 10
|
3月前
|
开发工具 iOS开发 MacOS
基于Vite7.1+Vue3+Pinia3+ArcoDesign网页版webos后台模板
最新版研发vite7+vue3.5+pinia3+arco-design仿macos/windows风格网页版OS系统Vite-Vue3-WebOS。
418 11
|
3月前
|
人工智能 安全 Java
【程序员必看】做Java,这一个AI插件就够了
飞算JavaAI插件助力开发者高效开发,覆盖需求分析、设计、编码全流程。智能分析、一键生成代码,大幅提升开发效率,让Java开发更轻松便捷。
|
3月前
|
存储 人工智能 Serverless
企业级 AI Agent 开发指南:基于函数计算 FC Sandbox 方案实现类 Chat Coding AI Agent
本文深入解析AI Agent系统架构,特别是以Sandbox为核心的落地实践。聚焦泛Chat模式下AI应用的挑战与解决方案,涵盖会话亲和性、隔离性、存储机制、会话恢复、资源弹性等关键技术点,阿里云函数计算(FC)为 AI Agent 系统在企业中的落地实践提供实际解决方案,展示了如何高效、安全地构建可扩展的 AI 应用系统。
|
1月前
|
自然语言处理 前端开发
基于Tauri2.9+Vite7.1+Vue3+Pinia3+ElementPlus客户端admin后台系统模板
最新研发tauri2.9+vite7.1+vue3 setup+pinia3+element-plus桌面版高颜值轻量级中后台管理系统TauriVue3Admin。
242 5