From 41f12685a510937009a97b57b54b1e3ed8f71c36 Mon Sep 17 00:00:00 2001 From: ZZJ <zzjdsg2300@163.com> Date: 星期六, 09 十月 2021 16:40:20 +0800 Subject: [PATCH] 全局颜色响应式 --- src/pages/vindicate/index/App.vue | 5 ++++- src/pages/desktop/index/App.vue | 11 +---------- src/pages/settings/views/generalSettings.vue | 2 +- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/pages/desktop/index/App.vue b/src/pages/desktop/index/App.vue index 86a5693..08d5c56 100644 --- a/src/pages/desktop/index/App.vue +++ b/src/pages/desktop/index/App.vue @@ -80,18 +80,9 @@ this.$refs.desktop.validateSn() } if (e.data.msg === 'changeColor') { - /* this.$store.state.desktop.minDocks.forEach(item=>{ - console.log(window.location.host); - console.log(item.url); - // window.postMessage(e.data.color,`${window.location.host}${item.url}`) - // window.postMessage(e.data.color,"http://localhost:8080/view/vindicate/") - - }) */ - const iframeArr = document.querySelectorAll("iframe") - console.log(iframeArr); iframeArr.forEach(item=>{ - console.log(item); + item.contentWindow.postMessage({msg:'changeColor',color:e.data.color},"*") }) } }); diff --git a/src/pages/settings/views/generalSettings.vue b/src/pages/settings/views/generalSettings.vue index 95f0429..6adaf69 100644 --- a/src/pages/settings/views/generalSettings.vue +++ b/src/pages/settings/views/generalSettings.vue @@ -860,7 +860,7 @@ height: 30px; border-radius:50% ; background-color: #fff; - padding: 3px; + padding: 4px; .color-option-content { width: 100%; height: 100%; diff --git a/src/pages/vindicate/index/App.vue b/src/pages/vindicate/index/App.vue index eb563ab..7c9649d 100644 --- a/src/pages/vindicate/index/App.vue +++ b/src/pages/vindicate/index/App.vue @@ -129,7 +129,10 @@ this.getLeftPer() console.log(99999); window.addEventListener("message",(e)=>{ - console.log(e); + console.log(999); + if(e.data.msg === 'changeColor') { + document.documentElement.style.setProperty('--colorCard',`${e.data.color}`) + } }) }, methods: { -- Gitblit v1.8.0