提交 ddb4c603 编写于 作者: fxy060608's avatar fxy060608

fix(h5): Remove the warning message when hideToast is called after the $route changes #1430

上级 e714397a
...@@ -7,7 +7,7 @@ export default { ...@@ -7,7 +7,7 @@ export default {
} }
}, },
created () { created () {
let showType = '' let showType = ''
const createOnShow = (type) => { const createOnShow = (type) => {
return (args) => { return (args) => {
...@@ -23,6 +23,9 @@ export default { ...@@ -23,6 +23,9 @@ export default {
const createOnHide = (type) => { const createOnHide = (type) => {
return () => { return () => {
if (!showType) {
return
}
let warnMsg = '' let warnMsg = ''
if (type === 'onHideToast' && showType !== 'onShowToast') { if (type === 'onHideToast' && showType !== 'onShowToast') {
warnMsg = '请注意 showToast 与 hideToast 必须配对使用' warnMsg = '请注意 showToast 与 hideToast 必须配对使用'
...@@ -31,7 +34,7 @@ export default { ...@@ -31,7 +34,7 @@ export default {
} }
if (warnMsg) { if (warnMsg) {
return console.warn(warnMsg) return console.warn(warnMsg)
} }
showType = '' showType = ''
setTimeout(() => { // 与 show 对应延迟10ms,避免快速调用 show,hide 导致无法关闭 setTimeout(() => { // 与 show 对应延迟10ms,避免快速调用 show,hide 导致无法关闭
this.showToast.visible = false this.showToast.visible = false
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册