概述:实现小程序上传图片到服务器 ,并保存到本地。仅供测试
我是刚开始学习小程序,如有问题请下方评论,跪拜!!!!!
实现效果:效果想要大家都看到 所以有点失真和变形,请谅解
实现步骤:
1:查看官方文档上传图片,下载图片公用API
API:https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html
2:上代码:
wxml:
<form bindsubmit="formSubmit" bindreset="formReset"> <view style='position: fixed; width: 100%;'>
<view class='tu1'>
<block wx:for="{
{img_arr}}" wx:key="index">
<view class='logoinfo'>
<image class='logoinfo' mode="aspectFill" src='{
{item}}' data-index="{
{index}}" bindtap="previewImg" bindlongpress="deleteImg" name="headimage" ></image>
</view>
</block>
<image bindtap='upimg' class='tu' src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1574928754865&di=a3371dc82dcca