首页 > 其他 > 详细

weex 长按图片保存

时间:2018-11-29 13:15:23      阅读:212      评论:0      收藏:0      [点我收藏+]

// 页面部分
<div v-for="(v,index) in imageList" :style="{ height: height + ‘px‘}" :key="index">
<image resize="cover"
@touchstart="start(index)" //点击图片开始
@touchend="end" //点击图片结束
:src="v.src" :style="{ height: height + ‘px‘, width: width + ‘px‘}">

提示// ios中需要配置权限 在xcode info.plist 加入NSPhotoLibraryAddUsageDescription 从而获取保存图片权限

//js部分 method里面

          start (index) {
            const self = this
            this.index  = index
            self.isShow = setTimeout(() => {
                    //这是weex官方提供的保存图片
                self.$refs[‘img‘].save(function(result) {
                        modal.toast({
                        message: `保存成功`,
                        duration: 0.3
                    })
                });
            }, 1000);
        },
        end () {
            clearInterval(this.isShow)
        }

weex 长按图片保存

原文:https://www.cnblogs.com/httpL/p/10037417.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!