Skip to content

Commit

Permalink
Merge pull request #55 from beclab/feat/app-service
Browse files Browse the repository at this point in the history
fix: update iframe theme
  • Loading branch information
wushuangs authored Nov 8, 2024
2 parents a19133c + 0b97e9a commit 30f583c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
14 changes: 7 additions & 7 deletions packages/frontend/package-lock.json

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

2 changes: 1 addition & 1 deletion packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"build": "quasar build -m pwa"
},
"dependencies": {
"@bytetrade/ui": "^0.1.28",
"@bytetrade/ui": "^0.1.29",
"@desktop/core": "0.1.0",
"@quasar/extras": "^1.16.7",
"@types/ua-parser-js": "0.7.36",
Expand Down
29 changes: 18 additions & 11 deletions packages/frontend/src/components/BasicWindow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -266,18 +266,25 @@ export default defineComponent({
}
};
// const message = (event: any) => {
// if (event.data.message === 'theme_update') {
// if (event.data.info.theme.toString() === '1') {
// $q.dark.set(false);
// } else {
// $q.dark.set(true);
// }
// }
// };
const message = (event: any) => {
if (event.data.message === 'theme_update') {
if (event.data.info.theme.toString() === '1') {
$q.dark.set(false);
} else {
$q.dark.set(true);
}
iframeRef.value.contentWindow.postMessage(
{
message: 'theme_apps_update',
info: event.data.info
},
'*'
);
}
};
onMounted(() => {
// window.addEventListener('message', message);
window.addEventListener('message', message);
nextTick(() => {
new MutationObserver(function (mutations) {
Expand Down Expand Up @@ -316,7 +323,7 @@ export default defineComponent({
});
onUnmounted(() => {
// window.removeEventListener('message', message);
window.removeEventListener('message', message);
});
return {
Expand Down

0 comments on commit 30f583c

Please sign in to comment.