uni-auth 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uni-auth",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "main": "src/index.js",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -32,3 +32,16 @@ export function hintOpenAuth(params = {}) {
32
32
  })
33
33
  })
34
34
  }
35
+
36
+ export const safeHeight = () => {
37
+ const obj = {
38
+ statusBarHeight: uni.getWindowInfo().statusBarHeight,
39
+ menuButtonHeight: 0,
40
+ }
41
+ if (uni.getMenuButtonBoundingClientRect) {
42
+ console.log(uni.getMenuButtonBoundingClientRect())
43
+ obj.menuButtonHeight = uni.getMenuButtonBoundingClientRect().height
44
+ obj.statusBarHeight = uni.getMenuButtonBoundingClientRect().top
45
+ }
46
+ return obj
47
+ }
@@ -1,13 +1,13 @@
1
1
  <template>
2
- <view class="auth-pop" v-if="isPermissionAlertShow">
2
+ <view class="auth-pop" :style="{ marginTop: safeH }" v-if="isPermissionAlertShow">
3
3
  <view class="title">{{ type }}权限使用说明</view>
4
4
  <view class="msg">{{ contentEnum['android'][type] }}</view>
5
5
  </view>
6
6
  </template>
7
7
 
8
8
  <script setup>
9
- import { onMounted, onUnmounted, ref } from 'vue'
10
- import { contentEnum } from '../common/index.js'
9
+ import { onMounted, onUnmounted, computed, ref } from 'vue'
10
+ import { contentEnum, safeHeight } from '../common/index.js'
11
11
  const type = ref('')
12
12
  const permissionListener = ref(null)
13
13
  const isPermissionAlertShow = ref(false)
@@ -22,6 +22,10 @@ onMounted(() => {
22
22
  isPermissionAlertShow.value = false
23
23
  })
24
24
  })
25
+ const safeH = computed(() => {
26
+ const { statusBarHeight, menuButtonHeight } = safeHeight()
27
+ return (statusBarHeight + menuButtonHeight || 70) + 20 + 'px'
28
+ })
25
29
  onUnmounted(() => {
26
30
  permissionListener.value.stop()
27
31
  })
@@ -38,7 +42,8 @@ onUnmounted(() => {
38
42
  box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.1);
39
43
  z-index: 999;
40
44
  border-radius: 14rpx;
41
- margin: 100rpx 5% 0;
45
+ margin-left: 5%;
46
+ margin-right: 5%;
42
47
  animation: identifier 1s ease-in-out;
43
48
  padding: 20rpx 30rpx;
44
49
  box-sizing: border-box;