优化项目
No files matched your search
@@ -1,55 +1,68 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<view class="custom-tab-bar">
|
<view class="custom-tab-bar">
|
||||||
<view
|
<!-- 首页 -->
|
||||||
v-for="(item, index) in tabList"
|
<view class="tab-bar-item" @click="switchTab(homeTab.pagePath)">
|
||||||
:key="index"
|
<image class="icon" :src="currentPath === homeTab.pagePath ? homeTab.selectedIconPath : homeTab.iconPath"></image>
|
||||||
class="tab-bar-item"
|
|
||||||
@click="switchTab(item.pagePath)"
|
<text class="text" :style="{color: currentPath === homeTab.pagePath ? selectedColor : color}">
|
||||||
>
|
{{ homeTab.text }}
|
||||||
<!-- 图标 -->
|
</text>
|
||||||
<image
|
</view>
|
||||||
class="icon"
|
<!-- 发现页 -->
|
||||||
:src="currentPath === item.pagePath ? item.selectedIconPath : item.iconPath"
|
<view class="tab-bar-item relative" @click="switchTab(findTab.pagePath)">
|
||||||
></image>
|
<image class="absolute top-[-10px] w-[36px] h-[36px]" :src="currentPath === findTab.pagePath ? findTab.selectedIconPath : findTab.iconPath"></image>
|
||||||
<!-- 文字 -->
|
|
||||||
<text
|
<!-- <text class="text" :style="{color: currentPath === findTab.pagePath ? selectedColor : color}">
|
||||||
class="text"
|
{{ findTab.text }}
|
||||||
:style="{color: currentPath === item.pagePath ? selectedColor : color}"
|
</text> -->
|
||||||
>
|
</view>
|
||||||
{{ item.text }}
|
<!-- 个人页面 -->
|
||||||
|
<view class="tab-bar-item" @click="switchTab(mineTab.pagePath)">
|
||||||
|
<image class="icon" :src="currentPath === mineTab.pagePath ? mineTab.selectedIconPath : mineTab.iconPath"></image>
|
||||||
|
|
||||||
|
<text class="text" :style="{color: currentPath === mineTab.pagePath ? selectedColor : color}">
|
||||||
|
{{ mineTab.text }}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted } from 'vue'
|
import {
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
ref,
|
||||||
|
onMounted
|
||||||
|
} from 'vue'
|
||||||
|
import {
|
||||||
|
onLoad
|
||||||
|
} from '@dcloudio/uni-app'
|
||||||
|
|
||||||
// ========== 配置数据 ==========
|
// ========== 配置数据 ==========
|
||||||
// 从你原来的配置迁移过来的数据
|
// 从你原来的配置迁移过来的数据
|
||||||
const color = '#999999'
|
const color = '#999999'
|
||||||
const selectedColor = '#AB002D'
|
const selectedColor = '#000'
|
||||||
const tabList = ref([
|
//首页配置
|
||||||
{
|
const homeTab = {
|
||||||
pagePath: "pages/index/index",
|
pagePath: "pages/index/index",
|
||||||
iconPath: "/static/tabbar/home.png",
|
iconPath: "/static/tabbar/home.png",
|
||||||
selectedIconPath: "/static/tabbar/active-home.png",
|
selectedIconPath: "/static/tabbar/active-home.png",
|
||||||
text: "首页"
|
text: "首页"
|
||||||
},
|
}
|
||||||
{
|
|
||||||
|
//发现页
|
||||||
|
const findTab = {
|
||||||
pagePath: "pages/order/index",
|
pagePath: "pages/order/index",
|
||||||
iconPath: "/static/tabbar/order.png",
|
iconPath: "/static/tabbar/find.png",
|
||||||
selectedIconPath: "/static/tabbar/active-order.png",
|
selectedIconPath: "/static/tabbar/active-find.png",
|
||||||
text: "订单"
|
text: "发现"
|
||||||
},
|
}
|
||||||
{
|
//个人页
|
||||||
|
const mineTab = {
|
||||||
pagePath: "pages/mine/index",
|
pagePath: "pages/mine/index",
|
||||||
iconPath: "/static/tabbar/mine.png",
|
iconPath: "/static/tabbar/mine.png",
|
||||||
selectedIconPath: "/static/tabbar/active-mine.png",
|
selectedIconPath: "/static/tabbar/active-mine.png",
|
||||||
text: "我的"
|
text: "我的"
|
||||||
}
|
}
|
||||||
])
|
|
||||||
|
|
||||||
// ========== 逻辑处理 ==========
|
// ========== 逻辑处理 ==========
|
||||||
const currentPath = ref('')
|
const currentPath = ref('')
|
||||||
@@ -66,7 +79,9 @@ const switchTab = (url) => {
|
|||||||
// 如果点击的是当前页,不执行跳转
|
// 如果点击的是当前页,不执行跳转
|
||||||
if (currentPath.value === url) return
|
if (currentPath.value === url) return
|
||||||
|
|
||||||
uni.switchTab({ url: '/' + url })
|
uni.switchTab({
|
||||||
|
url: '/' + url
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 组件挂载后获取当前路径
|
// 组件挂载后获取当前路径
|
||||||
@@ -82,9 +97,11 @@ onMounted(() => {
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
height: 50px; /* 根据需要调整高度 */
|
height: 50px;
|
||||||
|
/* 根据需要调整高度 */
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
border-top: 1px solid #000000; /* 对应 borderStyle: black */
|
|
||||||
|
/* 对应 borderStyle: black */
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@
|
|||||||
},
|
},
|
||||||
"proxy" : {
|
"proxy" : {
|
||||||
"/sale" : {
|
"/sale" : {
|
||||||
"target" : "http://110.v2-app.devcn.dabapiao.com",
|
"target" : "",
|
||||||
"changeOrigin" : true,
|
"changeOrigin" : true,
|
||||||
"secure" : false,
|
"secure" : false,
|
||||||
"pathRewrite" : {
|
"pathRewrite" : {
|
||||||
|
|||||||
@@ -30,13 +30,6 @@
|
|||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"path": "pages/product/index",
|
"path": "pages/product/index",
|
||||||
"style": {
|
"style": {
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ const handleBook = (productId) => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="h-[100vh] bg-[#9C032D]">
|
<view class="h-[100vh] bg-[#fff]">
|
||||||
|
|
||||||
<CustomTabBar />
|
<CustomTabBar />
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 974 B After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 755 B |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 1013 B After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 789 B |