提交 1b5dba11 编写于 作者: zhujiamin's avatar zhujiamin

debug notice传参问题

上级 46a97e13
import { toastController, alertController } from '@ionic/core'; import { toastController, alertController } from '@ionic/core';
import { Store } from 'vuex'; import store from '../../store';
/** /**
* 消息提示 * 消息提示
* *
...@@ -28,7 +28,7 @@ export class Notice { ...@@ -28,7 +28,7 @@ export class Notice {
* @memberof Notice * @memberof Notice
*/ */
constructor() { constructor() {
this.store = Store; this.store = store;
if (Notice.instance) { if (Notice.instance) {
return Notice.instance; return Notice.instance;
} }
...@@ -93,7 +93,7 @@ export class Notice { ...@@ -93,7 +93,7 @@ export class Notice {
* @returns {Promise<any>} * @returns {Promise<any>}
* @memberof Notice * @memberof Notice
*/ */
public async confirm(title: string, message: string, store?: Store<any>): Promise<boolean> { public async confirm(title: string, message: string): Promise<boolean> {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
const alert = await alertController.create({ const alert = await alertController.create({
header: title ? title : '标题', header: title ? title : '标题',
...@@ -103,8 +103,8 @@ export class Notice { ...@@ -103,8 +103,8 @@ export class Notice {
text: '取消', text: '取消',
role: 'cancel', role: 'cancel',
handler: () => { handler: () => {
if (store && store.commit) { if (this.store && this.store.commit) {
store.commit('setNoticeStatus',true); this.store.commit('setNoticeStatus',true);
} }
resolve(false); resolve(false);
} }
...@@ -113,18 +113,18 @@ export class Notice { ...@@ -113,18 +113,18 @@ export class Notice {
text: '确认', text: '确认',
cssClass: 'secondary', cssClass: 'secondary',
handler: () => { handler: () => {
if (store && store.commit) { if (this.store && this.store.commit) {
store.commit('setNoticeStatus',true); this.store.commit('setNoticeStatus',true);
} }
resolve(true); resolve(true);
} }
}, },
], ],
}); });
if (store && store.state && store.state.noticeStatus) { if (this.store && this.store.state && this.store.state.noticeStatus) {
await alert.present(); await alert.present();
if (store && store.commit) { if (this.store && this.store.commit) {
store.commit('setNoticeStatus',false); this.store.commit('setNoticeStatus',false);
} }
} }
}); });
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册