weex 长按图片保存

// 页面部分


<image resize="cover"
@touchstart="start(index)" //点击图片开始
@touchend="end" //点击图片结束
:src="v.src" :style="{ height: height + 'px', 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)
        }
原文地址:https://www.cnblogs.com/httpL/p/10037417.html