feat: 组件的点击事件的热区优化

This commit is contained in:
2025-08-10 20:44:40 +08:00
parent 59a4f5827f
commit 16b8885eb1
5 changed files with 121 additions and 113 deletions

View File

@@ -2,10 +2,12 @@
<view class="container">
<ModuleTitle :title="recommendTheme.themeName" />
<view class="container-scroll">
<view class="mk-card-item" v-for="(item, index) in recommendTheme.recommendPostsList" :key="index" @click="sendReply(item)">
<image :src="item.coverPhoto" mode="widthFix"></image>
<text>{{ item.topic }}</text>
</view>
<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>
</view>
</view>
</view>
</view>
</template>
@@ -20,7 +22,7 @@
default: {}
}
})
const sendReply = (item) => {
const topic = item.userInputContent || item.topic.replace(/^#/, '');
uni.$emit(RECOMMEND_POSTS_TITLE, topic);
@@ -29,20 +31,20 @@
</script>
<style lang="scss" scoped>
.container {
.container {
.container-scroll {
display: flex;
flex-direction: row;
overflow-x: auto;
margin-top: 4px;
/* 隐藏滚动条 */
scrollbar-width: none;
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
display: none;
}
.mk-card-item {
display: flex;
flex-direction: column;
@@ -52,7 +54,7 @@
background-color: #ffffff;
border-radius: 10px;
margin-right: 8px;
image {
width: 188px;
height: 112px;
@@ -67,4 +69,4 @@
}
}
}
</style>
</style>