< ビュークラス= "weuiセル" > < ビュークラス= "weui-cell__bd" > < ビュークラス= "weui-アップローダ" > < ビュークラス= "weui-uploader__hd" > < ビュークラス= "weui-uploader__title" >当前设备照片</ ビュー> < ビュークラス= "weui-uploader__info" > {{current.length}} / 3 </ ビュー> </ ビュー> <ビュークラス= "weui-uploader__bd"> < ビュークラス= "weui-uploader__files" ID = "uploaderFiles" > < ブロックWXのための:= "{{現在}}" WX:キー= "*この" > < ビュークラス= "weui-uploader__file" bindlongpress =」 currentDelImg " データ・インデックス= "{{索引}}" > < 画像クラス= "weui-uploader__img" SRC = "{{アイテム}}" ID = "{{アイテム}}" bindtap = "currentPreviewImage" モード=" aspectFill " /> </ ビュー> </ ブロック> </ 表示> < ビュークラス= "weui-uploader__inputボックス" WX:もし= "{{current.length <3}}" > < ビュークラス= "weui-uploader__input" bindtap = "currentChooseImage" > </ ビュー> </ ビュー> </ ビュー> </ ビュー> </ ビュー> </ ビュー>
/ * 画像削除* / :currentDelImg 機能(E){ VAR = この; VARの電流= that.data.currentを、 VARのインデックスを= e.currentTarget.dataset.index; // 現在の画像プレス添字を取得 wx.showModal ({ タイトル: 'プロンプト' 、 コンテンツ: '?あなたはあなたがこの写真を削除したい' 、 成功:機能(RES){ IF (res.confirm){ はconsole.log( '決定クリック' ); current.spliceを(インデックス、 1); } 他の IF (res.cancel){ はconsole.log( 'Cancelをクリック'を); 返す falseに; } that.setData({ 現在 }); } }) }
ます。https://www.cnblogs.com/zjj1990/p/11065012.htmlで再現