Skip to content

Commit

Permalink
nuxt builds
Browse files Browse the repository at this point in the history
  • Loading branch information
flashdesignory committed Oct 30, 2024
1 parent 4663a0c commit be08952
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 9 deletions.
11 changes: 8 additions & 3 deletions apps/news-site/news-site-nuxt-pages-router/partials/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@ const id = ref(route.name === "index" ? "home" : route.name);
const data = inject("data");
const { alerts, links } = data.value;
function updateShowMessage() {
function handleOnChange() {
const url = route.path;
requestIdleCallback(() => {
window.dispatchEvent(new CustomEvent("route-change-complete", { detail: { url } }));
});
showMessage.value = alerts[id]?.message ? true : false;
id.value = route.name === "index" ? "home" : route.name;
}
onMounted(updateShowMessage);
watch(() => route.path, updateShowMessage);
onMounted(handleOnChange);
watch(() => route.path, handleOnChange);
const closeMessage = () => {
showMessage.value = false;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions apps/news-site/news-site-nuxt/partials/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ const route = useRoute();
const data = inject("data");
const { alerts, links } = data.value;
function updateShowMessage() {
function handleOnChange() {
const url = route.path;
requestIdleCallback(() => {
window.dispatchEvent(new CustomEvent("route-change-complete", { detail: { url } }));
});
showMessage.value = alerts[route.name]?.message ? true : false;
}
onMounted(updateShowMessage);
watch(() => route.path, updateShowMessage);
onMounted(handleOnChange);
watch(() => route.path, handleOnChange);
const closeMessage = () => {
showMessage.value = false;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function sendMessage(message) {
}

window.addEventListener("route-change-complete", function(event){
console.log("route-change-complete", event.detail.url);
sendMessage({ type: "route-change-complete", url: event.detail.url, appId });
});

Expand Down

0 comments on commit be08952

Please sign in to comment.