From 90f15549bdfc8eafe595e23f757f86fdd56d29af Mon Sep 17 00:00:00 2001 From: Code <927627286@qq.com> Date: Sat, 12 Oct 2019 16:11:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20mobile=E6=A8=A1=E6=9D=BF=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E5=85=A8=E9=9D=A2=E5=B1=8F=20(#95)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/frameworks/mobile/assets/global.less | 14 ++++++++++++++ template/nuxt/nuxt.config.js | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/template/frameworks/mobile/assets/global.less b/template/frameworks/mobile/assets/global.less index 7f8f48a..4037096 100755 --- a/template/frameworks/mobile/assets/global.less +++ b/template/frameworks/mobile/assets/global.less @@ -1,5 +1,6 @@ body { font-size: 28px; + .safe-area-inset-bottom(); } .text-center { @@ -34,3 +35,16 @@ body { position: relative; height: 120px; } + +// 安全区适配 (https://developer.mozilla.org/en-US/docs/Web/CSS/@viewport/viewport-fit) +.safe-area-inset-bottom { + padding-bottom: constant(safe-area-inset-bottom); + padding-bottom: env(safe-area-inset-bottom); +} +// vant 组件安全区全局适配 +.van-tabbar--fixed, +.van-goods-action, +.van-submit-bar, +.van-popup--bottom { + .safe-area-inset-bottom(); +} diff --git a/template/nuxt/nuxt.config.js b/template/nuxt/nuxt.config.js index bf3e566..ee704f4 100644 --- a/template/nuxt/nuxt.config.js +++ b/template/nuxt/nuxt.config.js @@ -126,7 +126,11 @@ module.exports = { title: '', meta: [ {charset: 'utf-8'}, + <%_ if (template === 'mobile') { _%> + {name: 'viewport', content: 'width=device-width, initial-scale=1, user-scalable=no, viewport-fit=cover'}, + <%_ } else { _%> {name: 'viewport', content: 'width=device-width, initial-scale=1'}, + <%_ } _%> {'http-equiv': 'x-ua-compatible', content: 'IE=edge, chrome=1'}, { hid: 'description',