|
@@ -35,30 +35,31 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
-// unocss icon 默认不生效,需要在这里写一遍才能生效!注释掉也是生效的,但是必须要有!
|
|
|
|
|
-// i-carbon-code
|
|
|
|
|
-import { tabBarList as _tabBarList } from '@/utils/index'
|
|
|
|
|
|
|
+import { tabbarList as _tabBarList, CUSTOM_TABBAR_ENABLE } from './tabbarList'
|
|
|
import { tabbarStore } from './tabbar'
|
|
import { tabbarStore } from './tabbar'
|
|
|
|
|
+import {} from './tabbarList'
|
|
|
|
|
|
|
|
/** tabbarList 里面的 path 从 pages.config.ts 得到 */
|
|
/** tabbarList 里面的 path 从 pages.config.ts 得到 */
|
|
|
const tabbarList = _tabBarList.map((item) => ({ ...item, path: `/${item.pagePath}` }))
|
|
const tabbarList = _tabBarList.map((item) => ({ ...item, path: `/${item.pagePath}` }))
|
|
|
-
|
|
|
|
|
function selectTabBar({ value: index }: { value: number }) {
|
|
function selectTabBar({ value: index }: { value: number }) {
|
|
|
const url = tabbarList[index].path
|
|
const url = tabbarList[index].path
|
|
|
tabbarStore.setCurIdx(index)
|
|
tabbarStore.setCurIdx(index)
|
|
|
- uni.switchTab({ url })
|
|
|
|
|
|
|
+ if (CUSTOM_TABBAR_ENABLE) {
|
|
|
|
|
+ uni.navigateTo({ url })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ uni.switchTab({ url })
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
onLoad(() => {
|
|
onLoad(() => {
|
|
|
// 解决原生 tabBar 未隐藏导致有2个 tabBar 的问题
|
|
// 解决原生 tabBar 未隐藏导致有2个 tabBar 的问题
|
|
|
- // #ifdef APP-PLUS | H5
|
|
|
|
|
- uni.hideTabBar({
|
|
|
|
|
- fail(err) {
|
|
|
|
|
- console.log('hideTabBar fail: ', err)
|
|
|
|
|
- },
|
|
|
|
|
- success(res) {
|
|
|
|
|
- console.log('hideTabBar success: ', res)
|
|
|
|
|
- },
|
|
|
|
|
- })
|
|
|
|
|
- // #endif
|
|
|
|
|
|
|
+ !CUSTOM_TABBAR_ENABLE &&
|
|
|
|
|
+ uni.hideTabBar({
|
|
|
|
|
+ fail(err) {
|
|
|
|
|
+ console.log('hideTabBar fail: ', err)
|
|
|
|
|
+ },
|
|
|
|
|
+ success(res) {
|
|
|
|
|
+ console.log('hideTabBar success: ', res)
|
|
|
|
|
+ },
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
</script>
|
|
</script>
|