|
@@ -3,16 +3,19 @@ import { ConfigProviderThemeVars } from 'wot-design-uni'
|
|
|
import { useRouter } from '../core/utils/router'
|
|
|
import { computed } from 'vue'
|
|
|
|
|
|
-const props = defineProps<{
|
|
|
- transparent?: boolean
|
|
|
- title?: string
|
|
|
- dark?: boolean
|
|
|
- placeholder?: boolean
|
|
|
-}>()
|
|
|
+const props = withDefaults(
|
|
|
+ defineProps<{
|
|
|
+ transparent?: boolean
|
|
|
+ title?: string
|
|
|
+ dark?: boolean
|
|
|
+ placeholder?: boolean
|
|
|
+ }>(),
|
|
|
+ {},
|
|
|
+)
|
|
|
const slots = defineSlots<{
|
|
|
- // default(props: { data: Ref<S>[]; source: T }): any
|
|
|
prepend(): any
|
|
|
}>()
|
|
|
+const aa = computed(() => (slots.prepend ? 'left' : 'capsule'))
|
|
|
const router = useRouter()
|
|
|
const pages = computed(() => getCurrentPages())
|
|
|
const themeVars = computed<ConfigProviderThemeVars>(() => ({
|
|
@@ -23,6 +26,7 @@ const handleToHome = () => {
|
|
|
uni.reLaunch({ url: '/pages/home/index' })
|
|
|
}
|
|
|
onMounted(() => {
|
|
|
+ // console.log(slots.prepend)
|
|
|
// getCurrentPages()
|
|
|
// console.log(getCurrentPages())
|
|
|
})
|
|
@@ -37,52 +41,28 @@ onMounted(() => {
|
|
|
:bordered="false"
|
|
|
:custom-class="`${transparent ? 'bg-transparent!' : ''} `"
|
|
|
v-bind="{ title }"
|
|
|
- @click-left="!slots.prepend && router.back()"
|
|
|
>
|
|
|
- <!-- {{ pages }} -->
|
|
|
- <template v-if="slots.prepend" #left>
|
|
|
- <div class="flex items-center gap-4.5">
|
|
|
- <wd-icon
|
|
|
- v-if="pages.length === 1"
|
|
|
- name="home"
|
|
|
- size="50rpx"
|
|
|
- :color="dark ? 'white' : 'blacak'"
|
|
|
- @click="handleToHome"
|
|
|
- ></wd-icon>
|
|
|
- <wd-icon
|
|
|
- v-else
|
|
|
- name="arrow-left"
|
|
|
- size="48rpx"
|
|
|
- :color="dark ? 'white' : 'blacak'"
|
|
|
- @click="router.back()"
|
|
|
- ></wd-icon>
|
|
|
+ <template v-slot:[aa]>
|
|
|
+ <div class="flex items-center gap-4.5 w-full h-full">
|
|
|
+ <div class="flex items-center justify-center overflow-hidden">
|
|
|
+ <wd-icon
|
|
|
+ v-if="pages.length === 1"
|
|
|
+ name="home"
|
|
|
+ size="50rpx"
|
|
|
+ :color="dark ? 'white' : 'blacak'"
|
|
|
+ @click="handleToHome"
|
|
|
+ ></wd-icon>
|
|
|
+ <wd-icon
|
|
|
+ v-else
|
|
|
+ name="arrow-left"
|
|
|
+ size="48rpx"
|
|
|
+ :color="dark ? 'white' : 'blacak'"
|
|
|
+ @click="router.back()"
|
|
|
+ ></wd-icon>
|
|
|
+ </div>
|
|
|
<slot name="prepend"></slot>
|
|
|
</div>
|
|
|
</template>
|
|
|
- <template v-if="!slots.prepend" #capsule>
|
|
|
- <div class="w-full h-full">
|
|
|
- <!-- <wd-button
|
|
|
- type="icon"
|
|
|
- icon="home"
|
|
|
- :custom-style="`color: ${dark ? 'white' : 'black'}`"
|
|
|
- @click="handleToHome"
|
|
|
- ></wd-button> -->
|
|
|
- <wd-icon
|
|
|
- v-if="pages.length === 1"
|
|
|
- name="home"
|
|
|
- size="50rpx"
|
|
|
- :color="dark ? 'white' : 'blacak'"
|
|
|
- @click="handleToHome"
|
|
|
- ></wd-icon>
|
|
|
- <wd-icon
|
|
|
- v-else
|
|
|
- name="arrow-left"
|
|
|
- size="48rpx"
|
|
|
- :color="dark ? 'white' : 'blacak'"
|
|
|
- @click="router.back()"
|
|
|
- ></wd-icon>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
</wd-navbar>
|
|
|
<template v-if="props.placeholder">
|
|
|
<wd-navbar
|