From d689025bb7790115b521be2ac3fca290cc828dfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Mon, 2 Jul 2018 20:10:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96layer=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E5=9B=9E=E8=B0=83;=E4=BC=98=E5=8C=96store=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E7=9A=84=E7=B4=A2=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/js/layer/index.js | 6 +++++- src/js/store/index.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/js/layer/index.js b/src/js/layer/index.js index 5d4c561..7db282f 100644 --- a/src/js/layer/index.js +++ b/src/js/layer/index.js @@ -170,7 +170,11 @@ class __layer__ { } } if (typeof this.props.yes === 'function') { - this.props.yes.call(this, this.prompt, this.$id) + let cb = [this.$id] + if (this.type === 3) { + cb.unshift(this.prompt) + } + this.props.yes.apply(this, cb) } else { this.close() } diff --git a/src/js/store/index.js b/src/js/store/index.js index de0f9f8..286e2e5 100644 --- a/src/js/store/index.js +++ b/src/js/store/index.js @@ -185,7 +185,7 @@ class AnotStore { __INSERT__(item, primary) { let collection = __STORE__[this.__name__] let collectionDict = __STORE__[`${this.__name__}Dict`] - let _id = item[primary || `${this.__name__}_id`] + let _id = item[primary || 'id'] let tmp = collectionDict[_id] // 已存在, 则直接更新 if (tmp) {