优化页面
This commit is contained in:
@@ -11,8 +11,10 @@ const _sfc_main = {
|
||||
tabIndex: Number
|
||||
},
|
||||
setup(__props) {
|
||||
require.async("../../TUIKit/components/TUIConversation/entry.js");
|
||||
let showMiddleButton = common_vendor.ref(false);
|
||||
const conversationList = common_vendor.ref([]);
|
||||
let Unread = common_vendor.ref(0);
|
||||
common_vendor.onMounted(() => {
|
||||
common_vendor.Jt.watch(common_vendor.o.CONV, {
|
||||
conversationList: onConversationListUpdated
|
||||
@@ -25,7 +27,21 @@ const _sfc_main = {
|
||||
});
|
||||
function onConversationListUpdated(list) {
|
||||
conversationList.value = list;
|
||||
common_vendor.index.__f__("log", "at components/tabBar/tabBar.vue:51", "conversationList", list);
|
||||
Unread.value = calculateUnreadCount(list);
|
||||
}
|
||||
function calculateUnreadCount(arr) {
|
||||
let total = 0;
|
||||
for (const item of arr) {
|
||||
if (!item.hasOwnProperty("unreadCount")) {
|
||||
return null;
|
||||
}
|
||||
const count = item.unreadCount;
|
||||
if (typeof count !== "number" || !Number.isFinite(count)) {
|
||||
return null;
|
||||
}
|
||||
total += count;
|
||||
}
|
||||
return total;
|
||||
}
|
||||
let tabList = common_vendor.reactive([
|
||||
{
|
||||
@@ -67,10 +83,8 @@ const _sfc_main = {
|
||||
});
|
||||
common_vendor.index.getSystemInfo({
|
||||
success: function(res) {
|
||||
common_vendor.index.__f__("log", "at components/tabBar/tabBar.vue:99", "机型", res.deviceType);
|
||||
if (res.safeArea.top > 40) {
|
||||
common_vendor.index.__f__("log", "at components/tabBar/tabBar.vue:101", "苹果的底部栏大小", res.safeArea.top);
|
||||
}
|
||||
if (res.safeArea.top > 40)
|
||||
;
|
||||
}
|
||||
});
|
||||
function setTabBar() {
|
||||
@@ -123,14 +137,18 @@ const _sfc_main = {
|
||||
return (_ctx, _cache) => {
|
||||
return {
|
||||
a: common_vendor.f(common_vendor.unref(tabList), (item, index, i0) => {
|
||||
return {
|
||||
return common_vendor.e({
|
||||
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$1(($event) => handlePush(item, index), index),
|
||||
f: index
|
||||
};
|
||||
b: index === 3 && common_vendor.unref(Unread) > 0
|
||||
}, index === 3 && common_vendor.unref(Unread) > 0 ? {
|
||||
c: common_vendor.t(common_vendor.unref(Unread) > 99 ? "99+" : common_vendor.unref(Unread))
|
||||
} : {}, {
|
||||
d: common_vendor.t(item.text),
|
||||
e: __props.tabIndex == index ? "#1DD2F9" : "#A7A3A3",
|
||||
f: common_vendor.n("list-item flex flex-column flex-middle " + item.middleClass),
|
||||
g: common_vendor.o$1(($event) => handlePush(item, index), index),
|
||||
h: index
|
||||
});
|
||||
}),
|
||||
b: common_vendor.n(common_vendor.unref(showMiddleButton) === true ? "tab-list-middle" : "tab-list-default"),
|
||||
c: common_vendor.o$1(disabledScroll),
|
||||
|
||||
Reference in New Issue
Block a user