Catalog npm
PACKAGE EXPLORERView in registry

5g-fe-components

npm

# fe-5g-component 消息接收组件

uivue
Versions collected11
Direct dependencies34From release 1.1.0
Last observed20 Oct, 20:34 UTC

README

Current package documentation

5g-fe-components

fe-5g-component 消息接收组件

fe-5g-component 是一个功能丰富的消息接收组件,支持多种消息类型的展示和交互。

功能特性

  • 支持多种消息类型:

    • 文本消息
    • 撤回消息
    • 地理位置
    • 音频消息
    • 视频消息
    • 图片消息
    • 单卡片消息
    • 多卡片消息
  • 文本消息支持:

    • Markdown 格式
    • LaTeX 数学公式
    • 代码高亮
    • 链接自动识别
    • 手机号码自动识别和脱敏
    • 文本复制功能
  • 多媒体消息支持:

    • 图片预览
    • 视频播放
    • 音频播放
    • 地理位置查看

使用方法

基础用法

<template>
  <fe-5g-component
    :data="messageData"
    :floatMenuShow="true"
    :copyBtnShow="true"
    @play-audio="handlePlayAudio"
    @copy-text="handleCopyText"
    @redirect-url="handleRedirectUrl"
    @showSwiper="handleShowSwiper"
    @showPhotoLargeView="handleShowPhotoLargeView"
    @open-location="handleOpenLocation"
    @post-back="handlePostBack"
    @open-url="handleOpenUrl"
    @tel-click="handleTelClick"
  />
</template>
// main.js
import Fe5gCompoents from '5g-fe-components'
import '5g-fe-components/dist/index.css'
Vue.use(Fe5gCompoents)

Props

属性名类型必填说明
dataObject是消息数据对象
floatMenuShowBoolean否是否显示浮动菜单
copyBtnShowBoolean否是否显示复制按钮
useCustomImagePreviewBoolean否是否使用自定义的图片预览
dataPathString否数据路径,指向data中的卡片内容路径

消息数据格式

{
  contentType: String, // 消息类型:'text'|'Revoke'|'location'|'audio'|'video'|'image'|'singleCard'|'multiCard'
  message: String, // 文本消息内容
  messageId: String, // 消息ID
  data: {
    thumbUrl: String, // 缩略图URL
    audioUrl: String, // 音频URL
    videoUrl: String, // 视频URL
    imageUrl: String, // 图片URL
  },
  generalPurposeCard: { // 卡片消息数据
    content: Object,
    layout: {
      cardOrientation: String // 'vertical'|'horizontal'
    }
  }
}

事件

事件名说明参数
play-audio播放音频时触发-
copy-text复制文本时触发text: String
redirect-url点击链接时触发url: String
showSwiper显示图片轮播时触发{ isphotoOpen, photoItem, data }
showPhotoLargeView显示大图时触发{ isphotoOpen, src }
open-location打开地理位置时触发locationData: Object
post-back点击卡片回复时触发data: Object, idx: Number
open-url打开URL时触发item: Object
tel-click点击电话号码时触发item: Object

依赖

  • Muse-UI
  • Showdown (Markdown 转换)
  • Showdown-Katex (LaTeX 支持)
  • Highlight.js (代码高亮)

注意事项

  1. 文本消息支持 Markdown 格式,包括表格、删除线、下划线等语法
  2. 支持 LaTeX 数学公式,使用 $ 或 $$ 包裹
  3. 代码块会自动进行语法高亮
  4. 图片加载失败时会显示错误提示
  5. 视频下载功能在 iOS 设备上不可用
  6. 在微信环境中,视频下载需要通过复制链接到浏览器实现

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 11

Collected releases
VersionPublishedDirect dependenciesOpen version
1.1.0Registry latest23 Jun 202534
1.0.918 Jun 202533
1.0.818 Jun 202533
1.0.718 Jun 202533
1.0.618 Jun 202532
1.0.517 Jun 202530
1.0.416 Jun 202529
1.0.322 Apr 202517
1.0.222 Apr 202517
1.0.122 Apr 202517
1.0.021 Apr 202517

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 20:34 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:387824a32998ac91d8331bc22db830338f00a20b5bca1af3f9344a20d1e5294f