From e5608ba98c12acfb2327b340eb1e4c81bfa83a9d Mon Sep 17 00:00:00 2001 From: Khang Date: Sun, 17 Dec 2023 16:47:04 +0700 Subject: [PATCH] Fix toast --- src/.vuepress/components/GAffiliates.vue | 61 +++++++++++------------- 1 file changed, 29 insertions(+), 32 deletions(-) diff --git a/src/.vuepress/components/GAffiliates.vue b/src/.vuepress/components/GAffiliates.vue index bbe23272..eabd1ba1 100644 --- a/src/.vuepress/components/GAffiliates.vue +++ b/src/.vuepress/components/GAffiliates.vue @@ -7,40 +7,37 @@ import "vue-toastification/dist/index.css"; export default { data() { return { - mounted: false, - toast: createToastInterface({ - container: document.querySelector("#app"), - timeout: false, - position: POSITION.BOTTOM_LEFT, - showCloseButtonOnHover: true, - }), + /** @type {ReturnType} */ + toast: null, }; }, - watch: { - $route: { - deep: true, - immediate: true, - handler(route) { - if (route.path === "/" || this.mounted) return; - const Content = ( - - Build and launch your web app in days - - Check out - ShipFast - - - ); - this.toast(Content); - this.mounted = true; - }, + mounted() { + this.toast = createToastInterface({ + container: this.$root.$el, + timeout: false, + position: POSITION.BOTTOM_LEFT, + showCloseButtonOnHover: true, + }); + this.toast(this.getContent()); + }, + methods: { + getContent() { + return ( + + Build and launch your web app in days + + Check out + ShipFast + + + ); }, }, };