uni-app项目保存图片到相册

github地址,喜欢的可以star下哦
插件预览图

功能介绍
1.长按保存图片 2.右下角图片点击保存图片3.点击图片可以隐藏图片
使用教程
1.插件代码拷贝
下载后把components目录下saveFile.vue文件拷贝到自己项目目录下
2.插件全局配置
在项目里main.js中配置如下代码
import savefile from ‘./components/saveFile.vue’

Vue.component(‘savefile’,savefile)

3.插件使用
vue页面使用
<template>
<view>
<!– 预览图片 –>
<savefile v-if=”isShowPhoto” :url=”qrUrl” @hide=”hidePhoto”></savefile>
</view>
</template>

<script>
export default {
data() {
return {
qrUrl:’/static/img/img1.jpg’,
isShowPhoto:true,
};
},
onLoad() {},
methods: {
hidePhoto(){
this.isShowPhoto = false;
uni.showToast({
title:’图片已隐藏’,
icon:’none’
})
}
}
};
</script>

兼容性
uni-app项目中使用都兼容 除了H5

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理