zoukankan      html  css  js  c++  java
  • 小程序多图删除

                  <view class="weui-cell">
                                <view class="weui-cell__bd">
                                    <view class="weui-uploader">
                                        <view class="weui-uploader__hd">
                                            <view class="weui-uploader__title">当前设备照片</view>
                                            <view class="weui-uploader__info">{{current.length}}/3</view>
                                        </view>
                                        <view class="weui-uploader__bd">
                                            <view class="weui-uploader__files" id="uploaderFiles">
                                                <block wx:for="{{current}}" wx:key="*this">
                                                    <view class="weui-uploader__file" bindlongpress="currentDelImg" data-index="{{index}}">
                                                        <image class="weui-uploader__img" src="{{item}}" id="{{item}}" bindtap="currentPreviewImage" mode="aspectFill" />
                                                    </view>
                                                </block>
                                            </view>
                                            <view class="weui-uploader__input-box" wx:if="{{current.length < 3}}">
                                                <view class="weui-uploader__input" bindtap="currentChooseImage"></view>
                                            </view>
                                        </view>
                                    </view>
                                </view>
                            </view>
    /* 删除图片 */
        currentDelImg: function (e) {
            var that = this;
            var current = that.data.current;
            var index = e.currentTarget.dataset.index;//获取当前长按图片下标
            wx.showModal({
                title: '提示',
                content: '确定要删除此图片吗?',
                success: function (res) {
                    if (res.confirm) {
                        console.log('点击确定了');
                        current.splice(index, 1);
                    } else if (res.cancel) {
                        console.log('点击取消了');
                        return false;
                    }
                    that.setData({
                        current
                    });
                }
            })
        }
  • 相关阅读:
    3.1.3、控制结构
    3.1.2、变量
    3.1.1、渲染模板
    3.1、Jinja2模板引擎
    第3章 模板
    2.6、Flask扩展
    2.5.4、响应
    2.5.3、请求钩子
    2.5.2、请求调度
    2.5.1、程序和请求上下文
  • 原文地址:https://www.cnblogs.com/zjj1990/p/11065012.html
Copyright © 2011-2022 走看看