修复frame暗黑模式未自动切换

This commit is contained in:
fofolee 2022-05-15 10:12:07 +08:00
parent f18bb7b125
commit ee8a2cf10d

View File

@ -26,7 +26,8 @@
<script> <script>
import ObjectTree from "components/popup/ObjectTree"; import ObjectTree from "components/popup/ObjectTree";
const frameStyle = `<style>::-webkit-scrollbar { const frameStyle = `<style>
::-webkit-scrollbar {
width: 6px; width: 6px;
height: 6px; height: 6px;
} }
@ -44,7 +45,6 @@ const frameStyle = `<style>::-webkit-scrollbar {
body { body {
padding: 10px 20px; padding: 10px 20px;
margin: 0; margin: 0;
color: ${utools.isDarkColors() ? "white" : "unset"}
} }
</style> </style>
`; `;
@ -83,6 +83,7 @@ export default {
let cfw = this.$refs.iframe.contentWindow; let cfw = this.$refs.iframe.contentWindow;
Object.assign(cfw, this.context()); Object.assign(cfw, this.context());
cfw.onload = () => { cfw.onload = () => {
!utools.isDarkColors() || (cfw.document.body.style.color = "white");
let clientHeight = let clientHeight =
cfw.document.documentElement.getBoundingClientRect().height; cfw.document.documentElement.getBoundingClientRect().height;
this.frameHeight = clientHeight === 20 ? 0 : clientHeight; this.frameHeight = clientHeight === 20 ? 0 : clientHeight;