@liujitcn/kratos-uni-app-core 0.0.20 → 0.0.21

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.
@@ -1,20 +1,17 @@
1
1
  <script setup lang="ts">
2
2
  import { onLoad } from '@dcloudio/uni-app'
3
- import { ref } from 'vue'
3
+ import { computed, ref } from 'vue'
4
4
  import BootstrapStatus from '../../../components/BootstrapStatus.vue'
5
5
  import { initializeAppNavigation, launchAppStatus, navigateAppRoute } from '../../../navigation'
6
6
  import type { BootstrapViewKey } from '../../../module'
7
+ import { useI18n } from '../../../locales'
7
8
 
8
9
  const state = ref<BootstrapViewKey>('BOOTSTRAP_LOADING')
9
10
  const detail = ref('')
10
- const stateTitles: Record<BootstrapViewKey, string> = {
11
- BOOTSTRAP_LOADING: '正在加载',
12
- FORBIDDEN: '暂无访问权限',
13
- NOT_FOUND: '页面不存在',
14
- OFFLINE: '网络不可用',
15
- CONFIG_ERROR: '导航配置无效',
16
- PAGE_UNAVAILABLE: '页面暂不可用',
17
- }
11
+ const { t } = useI18n()
12
+ const stateTitle = computed(() =>
13
+ state.value === 'BOOTSTRAP_LOADING' ? t('core.status.loading') : t(`core.status.${state.value}`),
14
+ )
18
15
 
19
16
  onLoad(async (options) => {
20
17
  state.value = (options?.state as BootstrapViewKey | undefined) ?? 'BOOTSTRAP_LOADING'
@@ -32,5 +29,5 @@ onLoad(async (options) => {
32
29
  </script>
33
30
 
34
31
  <template>
35
- <BootstrapStatus :title="stateTitles[state]" :detail="detail" />
32
+ <BootstrapStatus :title="stateTitle" :detail="detail" />
36
33
  </template>
@@ -17,14 +17,14 @@
17
17
  <!-- #endif -->
18
18
 
19
19
  <view v-if="showFallback" class="webview-empty">
20
- <view class="webview-empty__title">链接无法打开</view>
20
+ <view class="webview-empty__title">{{ t('core.webview.openFailed') }}</view>
21
21
  <view class="webview-empty__desc">{{ emptyDesc }}</view>
22
22
  </view>
23
23
 
24
24
  <!-- #ifdef H5 -->
25
25
  <!-- X-Frame-Options 拒绝嵌入时浏览器仍可能触发 iframe load,始终保留外部打开入口。 -->
26
26
  <button v-if="isH5 && url && isIframeTimedOut" class="webview-open-button" @tap="openInBrowser">
27
- 新窗口打开
27
+ {{ t('common.action.openInNewWindow') }}
28
28
  </button>
29
29
  <!-- #endif -->
30
30
  </view>
@@ -33,20 +33,22 @@
33
33
  <script setup lang="ts">
34
34
  import { computed, ref } from 'vue'
35
35
  import { onLoad } from '@dcloudio/uni-app'
36
+ import { useI18n } from '../../../locales'
36
37
 
37
38
  const url = ref('')
38
39
  const isH5 = ref(false)
39
40
  const isIframeLoaded = ref(false)
40
41
  const isIframeTimedOut = ref(false)
42
+ const { t } = useI18n()
41
43
 
42
44
  const showFallback = computed(
43
45
  () => !url.value || (isH5.value && isIframeTimedOut.value && !isIframeLoaded.value),
44
46
  )
45
47
  const emptyDesc = computed(() => {
46
48
  if (!url.value) {
47
- return '缺少有效链接地址'
49
+ return t('core.webview.invalidUrl')
48
50
  }
49
- return '当前 H5 页面可能被目标站点限制嵌入'
51
+ return t('core.webview.embedBlocked')
50
52
  })
51
53
 
52
54
  onLoad((query) => {