From b2c185c918b1e0969630f8353608f7f15e94ae66 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Thu, 21 Nov 2019 18:51:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=82=E6=95=B0deleteScrip?= =?UTF-8?q?t=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/iron/widgets/Upload.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/vendor/iron/widgets/Upload.php b/vendor/iron/widgets/Upload.php index 3486a4b..69bf991 100644 --- a/vendor/iron/widgets/Upload.php +++ b/vendor/iron/widgets/Upload.php @@ -104,6 +104,28 @@ class Upload extends InputWidget /** * @var * 删除图片触发方法 + * $.ajax({ + * url: 'img-id-del', + * data: {data: data, imgid: $('#goods-image').val()}, + * success: function(data) + * { + * $('#goods-image').val(data); + * }, + * }); + * + * 路由方法 + * public function actionImgIdDel() + * { + * $alias = Yii::$app->request->get('data')['alias']; + * $imgid = Yii::$app->request->get('imgid'); + * $imgidarr = explode(',', $imgid); + * $temfile = TemFile::findOne(['alias' => $alias]); + * if ($temfile) { + * $imgidarr = array_diff($imgidarr, [$temfile->id]); + * } + * $imgidstr = implode(',', $imgidarr); + * return $imgidstr; + * } */ public $deleteScript;