|
@@ -23,6 +23,7 @@ document.body.appendChild(audioNode)
|
|
|
|
|
|
|
|
const uaParser = new UAParser()
|
|
const uaParser = new UAParser()
|
|
|
const uaInfo = uaParser.getResult()
|
|
const uaInfo = uaParser.getResult()
|
|
|
|
|
+console.log(uaInfo)
|
|
|
Vue.prototype.$uaInfo = uaInfo
|
|
Vue.prototype.$uaInfo = uaInfo
|
|
|
if (uaInfo.browser && uaInfo.browser.name === 'WeChat') {
|
|
if (uaInfo.browser && uaInfo.browser.name === 'WeChat') {
|
|
|
Vue.prototype.$isWeChat = true
|
|
Vue.prototype.$isWeChat = true
|
|
@@ -41,9 +42,25 @@ Vue.prototype.$msgCenter = new MessageCenter()
|
|
|
const idealWindowInnerWidth = 1125 // 设计稿的宽度
|
|
const idealWindowInnerWidth = 1125 // 设计稿的宽度
|
|
|
const idealRootFontSize = 24 // 设计稿里选择的根元素尺寸
|
|
const idealRootFontSize = 24 // 设计稿里选择的根元素尺寸
|
|
|
|
|
|
|
|
|
|
+let windowWidthLast = window.innerWidth
|
|
|
|
|
+let windowHeightLast = window.innerHeight
|
|
|
|
|
+
|
|
|
function onResize() {
|
|
function onResize() {
|
|
|
Vue.prototype.$oneRemToPx = window.innerWidth * idealRootFontSize / idealWindowInnerWidth
|
|
Vue.prototype.$oneRemToPx = window.innerWidth * idealRootFontSize / idealWindowInnerWidth
|
|
|
document.documentElement.style.fontSize = Vue.prototype.$oneRemToPx + 'px'
|
|
document.documentElement.style.fontSize = Vue.prototype.$oneRemToPx + 'px'
|
|
|
|
|
+
|
|
|
|
|
+ if (window.innerWidth === windowWidthLast) {
|
|
|
|
|
+ // 发生了高度变化,认为发生了软键盘显隐
|
|
|
|
|
+ if (uaInfo.os.name === 'Android') {
|
|
|
|
|
+ if (window.innerHeight < windowHeightLast) {
|
|
|
|
|
+ Vue.prototype.$msgCenter.publish('need-hide-bottom-bar')
|
|
|
|
|
+ } else if (window.innerHeight > windowHeightLast) {
|
|
|
|
|
+ Vue.prototype.$msgCenter.publish('need-show-bottom-bar')
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ windowWidthLast = window.innerWidth
|
|
|
|
|
+ windowHeightLast = window.innerHeight
|
|
|
}
|
|
}
|
|
|
onResize()
|
|
onResize()
|
|
|
window.addEventListener('resize', () => {
|
|
window.addEventListener('resize', () => {
|