@yinta/vue3-image-preview-loading
v1.0.0-beta.1
Published
vue3图片预览loading指令
Keywords
Readme
Vue Image Preview Loading
一个为 Element Plus 的 el-image 组件添加图片预览 loading 效果的 Vue 3 指令。
安装
npm install vue-image-preview-loading使用方法
1. 引入指令
import imagePreviewLoading from 'vue-image-preview-loading'
// 在 Vue 应用中注册指令
app.directive('imagePreviewLoading', imagePreviewLoading)2. 在模板中使用
<template>
<el-image
v-image-preview-loading
:src="imageUrl"
:preview-src-list="imageList"
fit="cover"
/>
</template>功能特性
- 自动监听图片预览器的渲染
- 显示 loading 动画效果
- 支持图片切换时的加载状态
- 自动清理内存,避免内存泄漏
注意事项
- 需要配合 Element Plus 的
el-image组件使用 - 适用于 Vue 3 项目
- 指令会自动注入必要的 CSS 样式
许可证
MIT
