feat(pc): 详情页增加吸顶返回列表按钮,首页按筛选签名恢复滚动位置
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ArrowLeft } from '@element-plus/icons-vue'
|
||||
import { goBackOrHome } from '@/shared/utils/routerBack'
|
||||
import {
|
||||
createMohongOrder,
|
||||
fetchMohongProduct,
|
||||
@@ -69,6 +71,10 @@ const activePayWayLabel = computed(() => {
|
||||
|
||||
onMounted(loadProduct)
|
||||
|
||||
function goBack() {
|
||||
goBackOrHome(router)
|
||||
}
|
||||
|
||||
async function loadProduct() {
|
||||
loading.value = true
|
||||
try {
|
||||
@@ -162,6 +168,12 @@ async function handleBuy() {
|
||||
|
||||
<template>
|
||||
<section v-loading="loading" class="mohong-detail-page">
|
||||
<div class="detail-back-bar">
|
||||
<button class="detail-back-btn" type="button" @click="goBack">
|
||||
<el-icon><ArrowLeft /></el-icon>
|
||||
<span>返回列表</span>
|
||||
</button>
|
||||
</div>
|
||||
<template v-if="product">
|
||||
<div class="detail-layout">
|
||||
<div class="gallery-panel">
|
||||
@@ -307,6 +319,44 @@ async function handleBuy() {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.detail-back-bar {
|
||||
/* 吸顶固定:始终显示在顶部导航栏(64px)下方,滚动时不跟随页面移走 */
|
||||
position: sticky;
|
||||
top: 78px;
|
||||
z-index: 20;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.detail-back-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
height: 36px;
|
||||
padding: 0 14px;
|
||||
border: 1px solid #eef1f5;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
color: #475569;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 2px 8px rgba(23, 35, 61, 0.08);
|
||||
transition:
|
||||
border-color 0.2s ease,
|
||||
color 0.2s ease,
|
||||
background 0.2s ease,
|
||||
box-shadow 0.2s ease;
|
||||
}
|
||||
|
||||
.detail-back-btn:hover {
|
||||
border-color: #ff6a00;
|
||||
background: #fff7ed;
|
||||
color: #ff6a00;
|
||||
box-shadow: 0 4px 12px rgba(255, 106, 0, 0.12);
|
||||
}
|
||||
|
||||
.detail-layout {
|
||||
display: grid;
|
||||
/* 左图固定合理宽度,右侧信息铺满剩余空间,避免整页右侧大片空白 */
|
||||
|
||||
Reference in New Issue
Block a user