修改效果
This commit is contained in:
@@ -3,7 +3,7 @@ import { computed } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
const props = defineProps({
|
||||
/** 外部列表(菜谱页等);首页不传则使用固定五项 */
|
||||
/** 外部列表(菜谱页等);首页不传则使用固定六项 */
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
@@ -55,6 +55,11 @@ const fixedTabs = [
|
||||
nameKey: 'pages.home.quickTabs.freshSeafoodToday',
|
||||
logoUrl: '/static/app/images/home/xiandahaixian.png',
|
||||
},
|
||||
{
|
||||
id: 'energy-meal',
|
||||
nameKey: 'pages.home.quickTabs.energyMeal',
|
||||
logoUrl: '/static/app/images/home/nengliangcan.png',
|
||||
},
|
||||
]
|
||||
|
||||
const useFixedTabs = computed(() => !props.list || props.list.length === 0)
|
||||
@@ -63,10 +68,6 @@ function selectTab(item: Record<string, unknown>) {
|
||||
emit('changeType', item[props.valueKey])
|
||||
}
|
||||
|
||||
function imageWidthByIndex(index: number) {
|
||||
return (index + 1) % 2 === 1 ? '104rpx' : '210rpx'
|
||||
}
|
||||
|
||||
function getTabName(item: Record<string, unknown>) {
|
||||
if (useFixedTabs.value && item.nameKey) {
|
||||
return t(String(item.nameKey))
|
||||
@@ -97,8 +98,7 @@ const displayList = computed(() =>
|
||||
<image
|
||||
class="tab-img"
|
||||
:src="getImage(item as Record<string, unknown>)"
|
||||
mode="scaleToFill"
|
||||
:style="{ width: imageWidthByIndex(index) }"
|
||||
mode="heightFix"
|
||||
/>
|
||||
<text class="tab-label line-clamp-1">{{ getTabName(item as Record<string, unknown>) }}</text>
|
||||
</view>
|
||||
@@ -122,7 +122,6 @@ const displayList = computed(() =>
|
||||
|
||||
.tab-img {
|
||||
height: 144rpx;
|
||||
width: auto;
|
||||
display: block;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
@@ -236,6 +236,10 @@ function handleItemClick(e) {
|
||||
}
|
||||
function tabsTypeChange(id: string | number) {
|
||||
const topic = String(id)
|
||||
if (topic === 'energy-meal') {
|
||||
navigateTo('/pages-store/pages/energy-meal/index')
|
||||
return
|
||||
}
|
||||
if (!isQuickTopicSlug(topic)) {
|
||||
return
|
||||
}
|
||||
@@ -310,6 +314,9 @@ function handleClickSwiper(item: any) {
|
||||
case 3: // 会员
|
||||
navigateTo('/pages-user/pages/member/index')
|
||||
break
|
||||
case 5: // 钱包
|
||||
navigateTo('/pages-user/pages/balance/index')
|
||||
break
|
||||
// case 4:
|
||||
// navigateTo('/pages/ai/chat/index')
|
||||
// break
|
||||
|
||||
Reference in New Issue
Block a user