mirror of
https://gitee.com/was666/as-editor-h5.git
synced 2026-07-24 00:00:03 +08:00
pc端的宽度显示设为375px,移动端适应
This commit is contained in:
+16
-1
@@ -24,7 +24,22 @@ export default {
|
||||
this.isRouterAlive = true
|
||||
})
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 判断是否为移动端
|
||||
if (
|
||||
!navigator.userAgent.match(
|
||||
/(iPhone|iPod|Android|ios|iOS|iPad|Backerry|WebOS|Symbian|Windows Phone|Phone)/i
|
||||
)
|
||||
) {
|
||||
// pc端的宽度显示设为375px
|
||||
let html = document.querySelector('html')
|
||||
html.style = 'font-size: 37.5px;width: 375px; margin: 0 auto;'
|
||||
window.onresize = () => {
|
||||
html.style = 'font-size: 37.5px;width: 375px; margin: 0 auto;'
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style lang="less">
|
||||
|
||||
Reference in New Issue
Block a user