-
Notifications
You must be signed in to change notification settings - Fork 358
Screen adaptation #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for vvmcsr ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
| <script> | ||
| let app = document.querySelector('#app') | ||
| window.addEventListener('load', function () { | ||
| app.style.minHeight = window.innerHeight + 'px' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不建议在应用入口处设置监听事件
| router.beforeEach((to) => { | ||
| to.meta.title !== undefined ? appSrapperTop.value = '46px' : appSrapperTop.value = '0px' | ||
| to.meta.title !== undefined ? appSrapperHeight.value = 'calc( 100% - 46px )' : appSrapperHeight.value = 'calc( 100% - 0px )' | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这段代码块可能不利于后期维护
|
|
||
| <template> | ||
| <main p="x4 y16" text-18 text="center gray-300 dark:gray-200"> | ||
| <main p="x4 y62" text-18 text="center gray-300 dark:gray-200"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里为什么要修改呢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在我的PR中,我把没有导航栏的页面 .app-wrapper的top值设为0,所以增加了 404.vue的padding值
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
了解
| <VanCell center title="🌗 暗黑模式"> | ||
| <template #right-icon> | ||
| <VanSwitch v-model="checked" size="20px" aria-label="on/off Dark Mode" @click="toggle()" /> | ||
| <div class="m-t-46"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个外层容器也可去掉
|
@ljt990218 谢谢这次PR,给了我很大的启发。
此外,针对这个问题我找到了一个更好的方式实现,咱们可以探讨。 /app.lesshtml, body {
height: 100%;
overflow: hidden; /* 禁止滚动条 */
}
#app {
height: 100%;
position: relative;
overflow-x: hidden;
overflow-y: auto;
}/App.vue.app-wrapper {
width: 100%;
position: absolute;
top: 46px;
left: 0;
}这种方案可能是更好的选择,因为它会更有效地利用浏览器的渲染引擎,并且在性能和可维护性方面更有优势。 |
OK |
我也发现了,你用这个方案再看下,辛苦!等待你的PR 😁 |

1、用 window.innerHeight 给 '#app' 的高度赋值
2、去掉全局的 '.app-wrapper' top 值,改为动态赋值