App.ku.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <script setup lang="ts">
  2. import { ref } from 'vue'
  3. import { useThemeStore } from '@/store'
  4. import FgTabbar from '@/tabbar/index.vue'
  5. import { isPageTabbar } from './tabbar/store'
  6. import { currRoute } from './utils'
  7. const themeStore = useThemeStore()
  8. const isCurrentPageTabbar = ref(true)
  9. onShow(() => {
  10. console.log('App.ku.vue onShow', currRoute())
  11. const { path } = currRoute()
  12. // “蜡笔小开心”提到本地是 '/pages/index/index',线上是 '/' 导致线上 tabbar 不见了
  13. // 所以这里需要判断一下,如果是 '/' 就当做首页,也要显示 tabbar
  14. if (path === '/') {
  15. isCurrentPageTabbar.value = true
  16. }
  17. else {
  18. isCurrentPageTabbar.value = isPageTabbar(path)
  19. }
  20. })
  21. const helloKuRoot = ref('Hello AppKuVue')
  22. const exposeRef = ref('this is form app.Ku.vue')
  23. defineExpose({
  24. exposeRef,
  25. })
  26. </script>
  27. <template>
  28. <wd-config-provider :theme-vars="themeStore.themeVars" :theme="themeStore.theme">
  29. <!-- 这个先隐藏了,知道这样用就行 -->
  30. <view class="hidden text-center">
  31. {{ helloKuRoot }},这里可以配置全局的东西
  32. </view>
  33. <KuRootView />
  34. <FgTabbar v-if="isCurrentPageTabbar" />
  35. <wd-toast />
  36. <wd-message-box />
  37. </wd-config-provider>
  38. </template>