更新记录

v0.1.0(2026-02-04) 下载此版本

初次发布


平台兼容性

uni-app(3.6.16)

Vue2 Vue3 Chrome Safari app-vue app-nvue Android iOS 鸿蒙
- - - - - -
微信小程序 支付宝小程序 抖音小程序 百度小程序 快手小程序 京东小程序 鸿蒙元服务 QQ小程序 飞书小程序 小红书小程序 快应用-华为 快应用-联盟
- - - - - - - - - - - -

一个 使用 svga 库封装的 uniapp APP svga 示例项目, 暂不支持声音播放

安装依赖

pnpm install svgaplayerweb

预览

使用示例

<template>
    <view class="page">
        <button @click="playSvga">播放 SVGA</button>

        <!-- #ifdef APP-PLUS -->
        <svga-app-player ref="svgaRef" @ready="onSvgaReady" @end="onSvgaEnd" @error="onSvgaError" />
        <!-- #endif -->
    </view>
</template>

<script setup>
import { ref } from "vue";
import SvgaAppPlayer from "@/components/svga-app-player/svga-app-player.vue";

const svgaRef = ref(null);

const playSvga = () => {
    const url = "/static/svga/rose.svga";
    svgaRef.value?.play(url);
};

const onSvgaReady = () => {
    console.log("SVGA 已加载,开始播放");
};

const onSvgaEnd = () => {
    console.log("SVGA 播放结束");
};

const onSvgaError = (err) => {
    console.error("SVGA 播放失败:", err);
};
</script>

<style scoped></style>

Method 实例方法

方法名 参数 返回值 说明
play src: string void 播放指定 SVGA 文件(本地路径或网络 URL)
stop void 停止当前播放并隐藏播放器

Events 事件

事件名 回调参数 说明
ready SVGA 资源加载完成,准备播放
end SVGA 播放完成
error error: string 加载或解析失败

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

暂无用户评论。