Skip to content

Commit

Permalink
Merge pull request #73 from Tencent/fix/message/complete-errors
Browse files Browse the repository at this point in the history
fix(message): complete error message when instance is not found
  • Loading branch information
LeeJim authored Jan 4, 2022
2 parents fe1105c + 42e100e commit 9d703b2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/message/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const getInstance = function (context?: Context, selector = '#t-message') {
}
const instance = context?.selectComponent(selector);
if (!instance) {
console.warn('未找到Message组件, 请检查selector是否正确');
return null;
}
return instance;
Expand All @@ -27,7 +26,10 @@ const showMessage = function (
) {
const { context, selector } = options;
const instance = getInstance(context, selector);
if (!instance) return Promise.reject();

if (!instance) {
return Promise.reject(new Error('未找到Message组件, 请检查selector是否正确'));
}

// instance.hide();

Expand Down

0 comments on commit 9d703b2

Please sign in to comment.