This commit is contained in:
pengxiaolong
2025-05-12 22:19:21 +08:00
parent 033cb649f8
commit c45c7c4de1
33 changed files with 322 additions and 58 deletions

View File

@@ -0,0 +1,91 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {
__name: "tabBar",
props: {
tabIndex: Number
},
setup(__props) {
let showMiddleButton = common_vendor.ref(false);
let tabList = common_vendor.reactive([
{
iconPath: "../../static/Pk.png",
selectedIconPath: "../../static/PkClick.png",
text: "PK",
pagePath: "../../pages/Home/Home",
middleClass: ""
},
{
iconPath: "../../static/Forum.png",
selectedIconPath: "../../static/Forumclick.png",
// text: '消息',
text: "论坛",
pagePath: "",
middleClass: ""
},
{
iconPath: "../../static/jiahao.png",
selectedIconPath: "../../static/jiahao.png",
text: "",
pagePath: "/pages/c/c",
middleClass: ""
},
{
iconPath: "../../static/Message.png",
selectedIconPath: "../../static/Messageclick.png",
text: "消息",
// text: '社区',
pagePath: ""
},
{
iconPath: "../../static/Mine.png",
selectedIconPath: "../../static/Mineclick.png",
text: "我的",
pagePath: "",
middleClass: ""
}
]);
common_vendor.onMounted(() => {
setTabBar();
});
common_vendor.index.getSystemInfo({
success: function(res) {
common_vendor.index.__f__("log", "at components/tabBar/tabBar.vue:89", "机型", res.deviceType);
if (res.safeArea.top > 40) {
common_vendor.index.__f__("log", "at components/tabBar/tabBar.vue:91", "苹果的底部栏大小", res.safeArea.top);
}
}
});
function setTabBar() {
let tabLength = tabList.length;
if (tabLength % 2) {
showMiddleButton.value = true;
let middleIndex = Math.floor(tabLength / 2);
tabList[middleIndex].middleClass = "mid-button";
}
}
common_vendor.ref();
const disabledScroll = () => {
return false;
};
return (_ctx, _cache) => {
return {
a: common_vendor.f(common_vendor.unref(tabList), (item, index, i0) => {
return {
a: __props.tabIndex == index ? item.selectedIconPath : item.iconPath,
b: common_vendor.t(item.text),
c: __props.tabIndex == index ? "#1DD2F9" : "#A7A3A3",
d: common_vendor.n("list-item flex flex-column flex-middle " + item.middleClass),
e: common_vendor.o(($event) => _ctx.handlePush(item, index), index),
f: index
};
}),
b: common_vendor.n(common_vendor.unref(showMiddleButton) === true ? "tab-list-middle" : "tab-list-default"),
c: common_vendor.o(disabledScroll)
};
};
}
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-c497a889"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/tabBar/tabBar.js.map

View File

@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@@ -0,0 +1 @@
<view class="tab-block data-v-c497a889"><view class="{{['tab-list', 'flex', 'flex-center', 'data-v-c497a889', b]}}"><view wx:for="{{a}}" wx:for-item="item" wx:key="f" class="{{['data-v-c497a889', item.d]}}" bindtap="{{item.e}}"><view class="item-img-box data-v-c497a889"><image class="item-img data-v-c497a889" src="{{item.a}}"/></view><view class="item-text font-20 data-v-c497a889" style="{{'color:' + item.c}}">{{item.b}}</view></view></view><view class="data-v-c497a889" catchtouchmove="{{c}}"></view></view>

View File

@@ -0,0 +1,107 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.flex.data-v-c497a889 {
display: flex;
flex-flow: row wrap;
}
.flex-center.data-v-c497a889 {
align-items: center;
justify-content: center;
}
.flex-column.data-v-c497a889 {
flex-direction: column;
align-items: center;
}
.flex-middle.data-v-c497a889 {
align-items: center;
}
.font-20.data-v-c497a889 {
font-size: 20rpx;
}
.tab-block.data-v-c497a889 {
position: relative;
position: fixed;
bottom: 0;
z-index: 999;
background-size: contain;
width: 100vw;
background-color: #ffffff;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.tab-block .tab-list.data-v-c497a889 {
height: 100rpx;
padding: 0;
z-index: 0;
}
.tab-block .tab-list-default.data-v-c497a889 {
background-color: #ffffff;
border-top: 1px #dddddd solid;
}
.tab-block .tab-list-middle.data-v-c497a889 {
position: relative;
background-size: cover;
}
.tab-block .list-item.data-v-c497a889 {
flex: 1;
}
.tab-block .list-item .item-img-box.data-v-c497a889 {
width: 38rpx;
height: 38rpx;
margin-bottom: 9rpx;
position: relative;
}
.tab-block .list-item .item-img.data-v-c497a889 {
width: 38rpx;
height: 38rpx;
color: red;
}
.tab-block .mid-button.data-v-c497a889 {
position: relative;
}
.tab-block .mid-button .item-img-box.data-v-c497a889 {
width: 150rpx;
height: 150rpx;
margin-bottom: 9rpx;
position: absolute;
z-index: 10;
top: -104rpx;
}
.tab-block .mid-button .item-img.data-v-c497a889 {
width: 150rpx;
height: 150rpx;
}
.tab-block .mid-button .item-text.data-v-c497a889 {
font-size: 20rpx;
position: absolute;
z-index: 1002;
bottom: -40rpx;
color: #393a41;
}
.tab-block .tab-bar.data-v-c497a889 {
height: 30rpx;
background-color: #ffffff;
}