|
|
|
@ -24,6 +24,32 @@ export default {
|
|
|
|
|
components: {
|
|
|
|
|
vHead,
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.init();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
init() {
|
|
|
|
|
this.forceLandscapeScreenHandle();
|
|
|
|
|
|
|
|
|
|
// 这里监控
|
|
|
|
|
this.onWindowSizeChanged();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
forceLandscapeScreenHandle() {
|
|
|
|
|
const body = document.getElementsByTagName("body")[0];
|
|
|
|
|
const html = document.getElementsByTagName("html")[0];
|
|
|
|
|
const width = html.clientWidth;
|
|
|
|
|
const height = html.clientHeight;
|
|
|
|
|
const max = width > height ? width : height;
|
|
|
|
|
const min = width > height ? height : width;
|
|
|
|
|
body.style.width = max + "px";
|
|
|
|
|
body.style.height = min + "px";
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onWindowSizeChanged() {
|
|
|
|
|
window.addEventListener("resize", this.forceLandscapeScreenHandle);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
created() {},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
@ -46,6 +72,23 @@ export default {
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media screen and (orientation: portrait) {
|
|
|
|
|
/*竖屏样式*/
|
|
|
|
|
#app {
|
|
|
|
|
transform-origin: 0 0;
|
|
|
|
|
transform: rotateZ(90deg) translateY(-100%);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// @media screen and (orientation: landscape) {
|
|
|
|
|
// /*这是横屏模式,所以您需要做一些不一样的事情*/
|
|
|
|
|
// #app {
|
|
|
|
|
// // position : absolute ;
|
|
|
|
|
// transform: rotate(0deg);
|
|
|
|
|
// transform-origin: 0% 0%;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
@media (max-width: 900px) {
|
|
|
|
|
.greenStyle .header {
|
|
|
|
|
// background: #000;
|
|
|
|
|