diff --git a/src/images/iphone.jpg b/src/images/iphone.jpg new file mode 100644 index 0000000..75c6580 Binary files /dev/null and b/src/images/iphone.jpg differ diff --git a/src/pages/index/index.jsx b/src/pages/index/index.jsx index df23607..3026ded 100644 --- a/src/pages/index/index.jsx +++ b/src/pages/index/index.jsx @@ -22,11 +22,29 @@ import { } from "taro-ui"; import { AtToast } from "taro-ui"; import { AtIcon } from "taro-ui"; +import iphone from "../../images/iphone.jpg"; const Index = () => { - useEffect(() => {}, []); + useEffect(() => { + const isPC = window.innerWidth > 1600; - return 11221; + if (isPC) { + const app = document.querySelector(".index"); + if (app) { + // 设置旋转后容器为屏幕高度宽、屏幕宽度高(注意:旋转后逻辑反转) + app.style.width = `${window.innerHeight}px`; + app.style.height = `${window.innerWidth}px`; + } + } + }, []); + + return ( + + + + + + ); }; export default Index; diff --git a/src/pages/index/index.scss b/src/pages/index/index.scss index c38a77d..e5c122e 100644 --- a/src/pages/index/index.scss +++ b/src/pages/index/index.scss @@ -1,15 +1,49 @@ .index { width: 100vw; height: 100vh; + // overflow: hidden; // 防止溢出 - // PC 浏览器下旋转 - @media (min-width: 1600px) { + .index_backImg { + width: 100%; + height: 100%; + background-color: yellowgreen; + + .index_backImg_bg { + width: 100%; + height: 100%; + } + } +} + + +// PC 浏览器下旋转 +@media (min-width: 1600px) { + .index { position: absolute; top: 0; left: 0; - width: 750px; // 根据标准宽度调整 + width: 750px; // 根据标准宽度调整 height: 1334px; // 保持竖屏比例 + // width: 100vw; // 使容器宽度始终填满视口 + // height: 100vh; // 使容器高度始终填满视口 transform: rotate(-90deg) translate(-100vh, 0); transform-origin: top left; + + .index_backImg { + width: 100%; + height: 100%; + // width: 100vw; + // height: 100vh; + background-color: yellow; + + .index_backImg_bg { + width: 100%; + height: 100%; + // object-fit: cover; // 确保图片铺满并保持宽高比 + } + } + + } -} + +} \ No newline at end of file