feat: 优化处理了滚动条的问题

This commit is contained in:
2025-08-13 19:29:11 +08:00
parent 6e365fd187
commit ef8d388837
8 changed files with 587 additions and 586 deletions

View File

@@ -47,6 +47,11 @@ body,
width: 100vw;
}
/*每个页面公共css */
::-webkit-scrollbar {
display: none;
}
.mb12 {
margin-bottom: 12px;
}

View File

@@ -50,12 +50,6 @@ const sendReply = (text) => {
-webkit-overflow-scrolling: touch;
padding-bottom: 12px;
box-sizing: border-box;
/* 隐藏滚动条 */
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
}
.more-tips-item {

View File

@@ -1,61 +1,71 @@
<template>
<view class="quick-access">
<view class="quick-access-scroll">
<view class="quick-access-item" v-for="(item, index) in itemList" :key="index" @click="sendReply(item)">
<image class="quick-access-item-bg" src="/static/quick/quick_icon_bg.png" mode="aspectFill"></image>
<view
class="quick-access-item"
v-for="(item, index) in itemList"
:key="index"
@click="sendReply(item)"
>
<image
class="quick-access-item-bg"
src="/static/quick/quick_icon_bg.png"
mode="aspectFill"
></image>
<view class="quick-access-item-title">
<image :src="item.icon"></image>
<text>{{ item.title }}</text>
</view>
<text class="quick-access-item-content">{{ item.content }}</text>
<text class="quick-access-item-content">{{
item.content
}}</text>
</view>
</view>
</view>
</template>
<script setup>
import { onMounted, ref } from 'vue';
const itemList = ref([])
import { onMounted, ref } from "vue";
const itemList = ref([]);
const emits = defineEmits(['replySent']);
const emits = defineEmits(["replySent"]);
const sendReply = (item) => {
emits('replySent', item); // 向父组件传递数据
}
emits("replySent", item); // 向父组件传递数据
};
onMounted(() => {
initData()
})
initData();
});
const initData = () => {
itemList.value = [
{
icon: '/static/quick/quick_icon_yuding.png',
title: '快速预定',
content: '预定门票、房间、餐食',
type: 'Command.quickBooking'
icon: "/static/quick/quick_icon_yuding.png",
title: "快速预定",
content: "预定门票、房间、餐食",
type: "Command.quickBooking",
},
{
icon: '/static/quick/quick_icon_find.png',
title: '探索发现',
content: '探索玩法、出片佳地',
type: 'Command.discovery'
icon: "/static/quick/quick_icon_find.png",
title: "探索发现",
content: "探索玩法、出片佳地",
type: "Command.discovery",
},
{
icon: '/static/quick/quick_icon_order.png',
title: '订单/工单',
content: '我的订单/工单',
type: 'MyOrder'
icon: "/static/quick/quick_icon_order.png",
title: "订单/工单",
content: "我的订单/工单",
type: "MyOrder",
},
{
icon: '/static/quick/quick_icon_call.png',
title: '呼叫服务',
content: '加水、客房服务等',
type: 'Command.createWorkOrder'
}
]
}
icon: "/static/quick/quick_icon_call.png",
title: "呼叫服务",
content: "加水、客房服务等",
type: "Command.createWorkOrder",
},
];
};
</script>
<style lang="scss" scoped>
@@ -68,12 +78,6 @@
overflow-x: auto;
white-space: nowrap;
-webkit-overflow-scrolling: touch;
/* 隐藏滚动条 */
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
}
.quick-access-item {
@@ -120,7 +124,7 @@
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 12px;
color: #201F32;
color: #201f32;
line-height: 16px;
}
}
@@ -131,10 +135,9 @@
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 10px;
color: #678CAD;
color: #678cad;
line-height: 18px;
}
}
}
</style>

View File

@@ -49,14 +49,6 @@
display: flex;
flex-direction: column;
.area-msg-list-content {
/* 隐藏滚动条 */
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
}
.message-item-ai {
display: flex;
justify-content: flex-start;
@@ -141,15 +133,6 @@
}
}
::-webkit-scrollbar {
display: none;
width: 0 !important;
height: 0 !important;
-webkit-appearance: none;
background: transparent;
color: transparent;
}
// 打字机光标闪烁动画
.typing-cursor {
display: inline-block;

View File

@@ -2,24 +2,46 @@
<view class="container">
<ModuleTitle :title="commodityDTO.title" />
<view class="container-scroll">
<view v-for="(item, index) in commodityDTO.commodityList" :key="`${item.commodityId}-${index}`">
<view
v-for="(item, index) in commodityDTO.commodityList"
:key="`${item.commodityId}-${index}`"
>
<view class="mk-card-item" @click="placeOrderHandle(item)">
<!-- <view class="card-badge">超值推荐</view> -->
<image class="card-img" :src="item.commodityIcon" mode="aspectFill" />
<image
class="card-img"
:src="item.commodityIcon"
mode="aspectFill"
/>
<view class="card-content">
<view class="card-title-column">
<text class="card-title">{{ item.commodityName }}</text>
<view class="card-tags" v-for="(tag) in item.commodityTradeRuleList" :key="tag">
<text class="card-title">{{
item.commodityName
}}</text>
<view
class="card-tags"
v-for="tag in item.commodityTradeRuleList"
:key="tag"
>
<text class="card-tag">{{ tag }}</text>
</view>
</view>
<template v-for="(serviceItem, index) in item.commodityServices" :key="serviceItem.serviceTitle">
<view v-if="index < 3" class="card-desc">· {{ serviceItem.serviceTitle }}</view>
<template
v-for="(
serviceItem, index
) in item.commodityServices"
:key="serviceItem.serviceTitle"
>
<view v-if="index < 3" class="card-desc"
>· {{ serviceItem.serviceTitle }}</view
>
</template>
<view class="card-bottom-row">
<view class="card-price-row">
<text class="card-price-fu">¥</text>
<text class="card-price">{{ item.commodityPrice }}</text>
<text class="card-price">{{
item.commodityPrice
}}</text>
<text class="card-unit">/人</text>
</view>
@@ -33,27 +55,25 @@
</template>
<script setup>
import ModuleTitle from '@/components/ModuleTitle/index.vue'
import { defineProps } from 'vue'
import ModuleTitle from "@/components/ModuleTitle/index.vue";
import { defineProps } from "vue";
const props = defineProps({
commodityDTO: {
type: Object,
default: {}
}
})
default: {},
},
});
/// 去下单
const placeOrderHandle = (item) => {
uni.navigateTo({
url: `/pages/goods/index?commodityId=${item.commodityId}`,
})
}
});
};
</script>
<style lang="scss" scoped>
.container {
.container-scroll {
display: flex;
flex-direction: row;
@@ -61,12 +81,6 @@
overflow-y: hidden;
margin: 4px 0;
/* 隐藏滚动条 */
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
.mk-card-item {
position: relative;
@@ -195,7 +209,6 @@
line-height: 32px;
}
}
}
}
</style>

View File

@@ -2,23 +2,45 @@
<view class="container">
<ModuleTitle title="相关商品" />
<view class="container-scroll">
<view v-for="(item, index) in commodityList" :key="`${item.commodityId}-${index}`">
<view
v-for="(item, index) in commodityList"
:key="`${item.commodityId}-${index}`"
>
<view class="mk-card-item" @click="placeOrderHandle(item)">
<image class="card-img" :src="item.commodityPhoto" mode="aspectFill" />
<image
class="card-img"
:src="item.commodityPhoto"
mode="aspectFill"
/>
<view class="card-content">
<view class="card-title-column">
<text class="card-title">{{ item.commodityName }}</text>
<view class="card-tags" v-for="(tag) in item.commodityTradeRuleList" :key="tag">
<text class="card-title">{{
item.commodityName
}}</text>
<view
class="card-tags"
v-for="tag in item.commodityTradeRuleList"
:key="tag"
>
<text class="card-tag">{{ tag }}</text>
</view>
</view>
<template v-for="(serviceItem, index) in item.commodityServices" :key="serviceItem.serviceTitle">
<view v-if="index < 3" class="card-desc">· {{ serviceItem.serviceTitle }}</view>
<template
v-for="(
serviceItem, index
) in item.commodityServices"
:key="serviceItem.serviceTitle"
>
<view v-if="index < 3" class="card-desc"
>· {{ serviceItem.serviceTitle }}</view
>
</template>
<view class="card-bottom-row">
<view class="card-price-row">
<text class="card-price-fu">¥</text>
<text class="card-price">{{ item.specificationPrice }}</text>
<text class="card-price">{{
item.specificationPrice
}}</text>
<text class="card-unit">/人</text>
</view>
<text class="card-btn">下单</text>
@@ -31,22 +53,21 @@
</template>
<script setup>
import ModuleTitle from '@/components/ModuleTitle/index.vue'
import { defineProps } from 'vue'
import ModuleTitle from "@/components/ModuleTitle/index.vue";
import { defineProps } from "vue";
const props = defineProps({
commodityList: {
type: Array,
default: []
}
})
default: [],
},
});
/// 去下单
const placeOrderHandle = (item) => {
uni.navigateTo({
url: `/pages/goods/index?commodityId=${item.commodityId}`,
})
}
});
};
</script>
<style lang="scss" scoped>
@@ -60,12 +81,6 @@
overflow-y: hidden;
margin: 4px 0;
/* 隐藏滚动条 */
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
.mk-card-item {
position: relative;
@@ -194,7 +209,6 @@
line-height: 32px;
}
}
}
}
</style>

View File

@@ -2,7 +2,10 @@
<view class="container">
<ModuleTitle :title="recommendTheme.themeName" />
<view class="container-scroll">
<view v-for="(item, index) in recommendTheme.recommendPostsList" :key="index">
<view
v-for="(item, index) in recommendTheme.recommendPostsList"
:key="index"
>
<view class="mk-card-item" @click="sendReply(item)">
<image :src="item.coverPhoto" mode="widthFix"></image>
<text>{{ item.topic }}</text>
@@ -13,38 +16,30 @@
</template>
<script setup>
import ModuleTitle from '@/components/ModuleTitle/index.vue'
import { RECOMMEND_POSTS_TITLE } from '@/constant/constant'
import { defineProps } from 'vue'
import ModuleTitle from "@/components/ModuleTitle/index.vue";
import { RECOMMEND_POSTS_TITLE } from "@/constant/constant";
import { defineProps } from "vue";
const props = defineProps({
recommendTheme: {
type: Object,
default: {}
}
})
default: {},
},
});
const sendReply = (item) => {
const topic = item.userInputContent || item.topic.replace(/^#/, '');
const topic = item.userInputContent || item.topic.replace(/^#/, "");
uni.$emit(RECOMMEND_POSTS_TITLE, topic);
}
};
</script>
<style lang="scss" scoped>
.container {
.container-scroll {
display: flex;
flex-direction: row;
overflow-x: auto;
margin-top: 4px;
/* 隐藏滚动条 */
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
.mk-card-item {
display: flex;
flex-direction: column;

View File

@@ -44,12 +44,6 @@
overflow-x: auto;
margin-top: 4px;
/* 隐藏滚动条 */
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
.mk-card-item {
flex-shrink: 0; /* 关键:防止 flex 布局压缩子元素宽度 */
width: 142px;