Skip to content

Commit

Permalink
fix: hideToastWindow
Browse files Browse the repository at this point in the history
  • Loading branch information
yacheng committed Dec 16, 2019
1 parent e7b3529 commit 29953be
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions packages/toast/src/web/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,23 @@ let styles = {
function showToastWindow(message: string): void {
if (!toastWin) {
toastWin = document.createElement('div');

for (let key in styles.container) {
toastWin.style[key] = styles.container[key];
}

document.body.appendChild(toastWin);
}

toastWin.textContent = message;
toastWin.style.transform = 'translateX(-50%)';
toastWin.style.webkitTransform = 'translateX(-50%)';

// setTimeout(() => {
// toastWin.style.backgroundColor = 'rgba(0, 0, 0, 0.6)';
// }, 0);
}

function hideToastWindow(): void {
if (!toastWin) return;

setTimeout((): void => {
toastWin.style.transform = 'translateX(-50%) scale(0.8)';
toastWin.style.webkitTransform = 'translateX(-50%) scale(0.8)';
if (toastWin && toastWin.style) {
toastWin.style.transform = 'translateX(-50%) scale(0.8)';
toastWin.style.webkitTransform = 'translateX(-50%) scale(0.8)';
}
}, 0);
}

Expand Down

0 comments on commit 29953be

Please sign in to comment.