feat(消息页面): 优化消息列表布局并添加动态高度计算
- 添加@tarojs/extend依赖用于DOM操作 - 为页面元素添加ID便于定位 - 重构消息列表布局,调整列宽和间距 - 实现动态计算滚动区域高度 - 增加更多模拟数据确保滚动效果 - 优化样式表结构和部分样式覆盖
Showing
3 changed files
with
232 additions
and
270 deletions
| ... | @@ -40,6 +40,7 @@ | ... | @@ -40,6 +40,7 @@ |
| 40 | "@nutui/icons-vue-taro": "^0.0.9", | 40 | "@nutui/icons-vue-taro": "^0.0.9", |
| 41 | "@nutui/nutui-taro": "^4.3.13", | 41 | "@nutui/nutui-taro": "^4.3.13", |
| 42 | "@tarojs/components": "4.1.2", | 42 | "@tarojs/components": "4.1.2", |
| 43 | + "@tarojs/extend": "^4.1.3", | ||
| 43 | "@tarojs/helper": "4.1.2", | 44 | "@tarojs/helper": "4.1.2", |
| 44 | "@tarojs/plugin-framework-vue3": "4.1.2", | 45 | "@tarojs/plugin-framework-vue3": "4.1.2", |
| 45 | "@tarojs/plugin-html": "4.1.2", | 46 | "@tarojs/plugin-html": "4.1.2", | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | <view class="messages-page"> | 2 | <view class="messages-page"> |
| 3 | <!-- Header --> | 3 | <!-- Header --> |
| 4 | - <view class="bg-orange-400 p-4 pt-8"> | 4 | + <view id="page-header" class="bg-orange-400 p-4 pt-8"> |
| 5 | <view class="text-xl font-bold text-white mb-3">消息</view> | 5 | <view class="text-xl font-bold text-white mb-3">消息</view> |
| 6 | <!-- Search Bar --> | 6 | <!-- Search Bar --> |
| 7 | <nut-searchbar v-model="searchValue" placeholder="搜索消息" shape="round" background="transparent" | 7 | <nut-searchbar v-model="searchValue" placeholder="搜索消息" shape="round" background="transparent" |
| ... | @@ -13,13 +13,15 @@ | ... | @@ -13,13 +13,15 @@ |
| 13 | </view> | 13 | </view> |
| 14 | 14 | ||
| 15 | <!-- Tab Navigation --> | 15 | <!-- Tab Navigation --> |
| 16 | - <nut-tabs v-model="activeTab" @click="onTabClick"> | 16 | + <nut-tabs id="page-filter" v-model="activeTab" @click="onTabClick"> |
| 17 | <nut-tab-pane title="全部" pane-key="all"> | 17 | <nut-tab-pane title="全部" pane-key="all"> |
| 18 | - <scroll-view class="conversation-list" scroll-y @scrolltolower="loadMore" :lower-threshold="50"> | 18 | + <scroll-view class="conversation-list" :style="scrollStyle" :scroll-y="true" @scrolltolower="loadMore" |
| 19 | - <view v-for="conversation in filteredConversations" :key="conversation.id" class="conversation-item mt-2 mb-4 border-b border-gray-100 pb-2" | 19 | + @scroll="scroll" :lower-threshold="50" :enable-flex="false"> |
| 20 | + <view v-for="conversation in filteredConversations" :key="conversation.id" | ||
| 21 | + class="conversation-item mt-2 mb-4 border-b border-gray-100 pb-2" | ||
| 20 | @click="onConversationClick(conversation)"> | 22 | @click="onConversationClick(conversation)"> |
| 21 | <nut-row> | 23 | <nut-row> |
| 22 | - <nut-col :span="4" class="avatar-container"> | 24 | + <nut-col :span="6" class="avatar-container"> |
| 23 | <view class="relative"> | 25 | <view class="relative"> |
| 24 | <image v-if="conversation.avatar" :src="conversation.avatar" | 26 | <image v-if="conversation.avatar" :src="conversation.avatar" |
| 25 | class="w-12 h-12 rounded-full object-cover" mode="aspectFill" /> | 27 | class="w-12 h-12 rounded-full object-cover" mode="aspectFill" /> |
| ... | @@ -51,11 +53,13 @@ | ... | @@ -51,11 +53,13 @@ |
| 51 | </nut-tab-pane> | 53 | </nut-tab-pane> |
| 52 | 54 | ||
| 53 | <nut-tab-pane title="未读" pane-key="unread"> | 55 | <nut-tab-pane title="未读" pane-key="unread"> |
| 54 | - <scroll-view class="conversation-list" scroll-y @scrolltolower="loadMore" :lower-threshold="50"> | 56 | + <scroll-view class="conversation-list" :style="scrollStyle" :scroll-y="true" @scrolltolower="loadMore" :lower-threshold="50" |
| 55 | - <view v-for="conversation in filteredConversations" :key="conversation.id" class="conversation-item" | 57 | + :enable-flex="false"> |
| 58 | + <view v-for="conversation in filteredConversations" :key="conversation.id" | ||
| 59 | + class="conversation-item mt-2 mb-4 border-b border-gray-100 pb-2" | ||
| 56 | @click="onConversationClick(conversation)"> | 60 | @click="onConversationClick(conversation)"> |
| 57 | <nut-row> | 61 | <nut-row> |
| 58 | - <nut-col :span="4" class="avatar-container"> | 62 | + <nut-col :span="6" class="avatar-container"> |
| 59 | <view class="relative"> | 63 | <view class="relative"> |
| 60 | <image v-if="conversation.avatar" :src="conversation.avatar" | 64 | <image v-if="conversation.avatar" :src="conversation.avatar" |
| 61 | class="w-12 h-12 rounded-full object-cover" mode="aspectFill" /> | 65 | class="w-12 h-12 rounded-full object-cover" mode="aspectFill" /> |
| ... | @@ -65,7 +69,7 @@ | ... | @@ -65,7 +69,7 @@ |
| 65 | </view> | 69 | </view> |
| 66 | </view> | 70 | </view> |
| 67 | </nut-col> | 71 | </nut-col> |
| 68 | - <nut-col :span="20" class="content-container"> | 72 | + <nut-col :span="19" class="content-container"> |
| 69 | <view class="flex justify-between items-center mb-1"> | 73 | <view class="flex justify-between items-center mb-1"> |
| 70 | <text class="font-medium truncate flex-1 mr-2">{{ conversation.name }}</text> | 74 | <text class="font-medium truncate flex-1 mr-2">{{ conversation.name }}</text> |
| 71 | <view class="flex items-center flex-shrink-0"> | 75 | <view class="flex items-center flex-shrink-0"> |
| ... | @@ -87,11 +91,13 @@ | ... | @@ -87,11 +91,13 @@ |
| 87 | </nut-tab-pane> | 91 | </nut-tab-pane> |
| 88 | 92 | ||
| 89 | <nut-tab-pane title="通知" pane-key="notification"> | 93 | <nut-tab-pane title="通知" pane-key="notification"> |
| 90 | - <scroll-view class="conversation-list" scroll-y @scrolltolower="loadMore" :lower-threshold="50"> | 94 | + <scroll-view class="conversation-list" :style="scrollStyle" :scroll-y="true" @scrolltolower="loadMore" :lower-threshold="50" |
| 91 | - <view v-for="conversation in filteredConversations" :key="conversation.id" class="conversation-item" | 95 | + :enable-flex="false"> |
| 96 | + <view v-for="conversation in filteredConversations" :key="conversation.id" | ||
| 97 | + class="conversation-item mt-2 mb-4 border-b border-gray-100 pb-2" | ||
| 92 | @click="onConversationClick(conversation)"> | 98 | @click="onConversationClick(conversation)"> |
| 93 | <nut-row> | 99 | <nut-row> |
| 94 | - <nut-col :span="4" class="avatar-container"> | 100 | + <nut-col :span="6" class="avatar-container"> |
| 95 | <view class="relative"> | 101 | <view class="relative"> |
| 96 | <image v-if="conversation.avatar" :src="conversation.avatar" | 102 | <image v-if="conversation.avatar" :src="conversation.avatar" |
| 97 | class="w-12 h-12 rounded-full object-cover" mode="aspectFill" /> | 103 | class="w-12 h-12 rounded-full object-cover" mode="aspectFill" /> |
| ... | @@ -101,7 +107,7 @@ | ... | @@ -101,7 +107,7 @@ |
| 101 | </view> | 107 | </view> |
| 102 | </view> | 108 | </view> |
| 103 | </nut-col> | 109 | </nut-col> |
| 104 | - <nut-col :span="20" class="content-container"> | 110 | + <nut-col :span="19" class="content-container"> |
| 105 | <view class="flex justify-between items-center mb-1"> | 111 | <view class="flex justify-between items-center mb-1"> |
| 106 | <text class="font-medium truncate flex-1 mr-2">{{ conversation.name }}</text> | 112 | <text class="font-medium truncate flex-1 mr-2">{{ conversation.name }}</text> |
| 107 | <view class="flex items-center flex-shrink-0"> | 113 | <view class="flex items-center flex-shrink-0"> |
| ... | @@ -123,11 +129,13 @@ | ... | @@ -123,11 +129,13 @@ |
| 123 | </nut-tab-pane> | 129 | </nut-tab-pane> |
| 124 | 130 | ||
| 125 | <nut-tab-pane title="留言" pane-key="message"> | 131 | <nut-tab-pane title="留言" pane-key="message"> |
| 126 | - <scroll-view class="conversation-list" scroll-y @scrolltolower="loadMore" :lower-threshold="50"> | 132 | + <scroll-view class="conversation-list" :style="scrollStyle" :scroll-y="true" @scrolltolower="loadMore" :lower-threshold="50" |
| 127 | - <view v-for="conversation in filteredConversations" :key="conversation.id" class="conversation-item" | 133 | + :enable-flex="false"> |
| 134 | + <view v-for="conversation in filteredConversations" :key="conversation.id" | ||
| 135 | + class="conversation-item mt-2 mb-4 border-b border-gray-100 pb-2" | ||
| 128 | @click="onConversationClick(conversation)"> | 136 | @click="onConversationClick(conversation)"> |
| 129 | <nut-row> | 137 | <nut-row> |
| 130 | - <nut-col :span="4" class="avatar-container"> | 138 | + <nut-col :span="6" class="avatar-container"> |
| 131 | <view class="relative"> | 139 | <view class="relative"> |
| 132 | <image v-if="conversation.avatar" :src="conversation.avatar" | 140 | <image v-if="conversation.avatar" :src="conversation.avatar" |
| 133 | class="w-12 h-12 rounded-full object-cover" mode="aspectFill" /> | 141 | class="w-12 h-12 rounded-full object-cover" mode="aspectFill" /> |
| ... | @@ -137,7 +145,7 @@ | ... | @@ -137,7 +145,7 @@ |
| 137 | </view> | 145 | </view> |
| 138 | </view> | 146 | </view> |
| 139 | </nut-col> | 147 | </nut-col> |
| 140 | - <nut-col :span="20" class="content-container"> | 148 | + <nut-col :span="19" class="content-container"> |
| 141 | <view class="flex justify-between items-center mb-1"> | 149 | <view class="flex justify-between items-center mb-1"> |
| 142 | <text class="font-medium truncate flex-1 mr-2">{{ conversation.name }}</text> | 150 | <text class="font-medium truncate flex-1 mr-2">{{ conversation.name }}</text> |
| 143 | <view class="flex items-center flex-shrink-0"> | 151 | <view class="flex items-center flex-shrink-0"> |
| ... | @@ -169,6 +177,11 @@ import { ref, computed, onMounted, markRaw } from 'vue' | ... | @@ -169,6 +177,11 @@ import { ref, computed, onMounted, markRaw } from 'vue' |
| 169 | import Taro from '@tarojs/taro' | 177 | import Taro from '@tarojs/taro' |
| 170 | import { Search2, Notice, Message } from '@nutui/icons-vue-taro' | 178 | import { Search2, Notice, Message } from '@nutui/icons-vue-taro' |
| 171 | import TabBar from '@/components/TabBar.vue' | 179 | import TabBar from '@/components/TabBar.vue' |
| 180 | +import { $ } from '@tarojs/extend' | ||
| 181 | + | ||
| 182 | +const scrollStyle = ref({ | ||
| 183 | + height: 'calc(100vh - 500rpx)' | ||
| 184 | +}) | ||
| 172 | 185 | ||
| 173 | // 搜索值 | 186 | // 搜索值 |
| 174 | const searchValue = ref('') | 187 | const searchValue = ref('') |
| ... | @@ -188,102 +201,24 @@ const conversations = ref([]) | ... | @@ -188,102 +201,24 @@ const conversations = ref([]) |
| 188 | 201 | ||
| 189 | // 初始化数据 | 202 | // 初始化数据 |
| 190 | const initData = () => { | 203 | const initData = () => { |
| 191 | - const mockData = [ | 204 | + const mockData = [] |
| 192 | - { | 205 | + |
| 193 | - id: 1, | 206 | + // 生成更多初始数据确保可以滚动 |
| 194 | - name: '张三', | 207 | + for (let i = 1; i <= 15; i++) { |
| 195 | - avatar: 'https://randomuser.me/api/portraits/men/32.jpg', | 208 | + const types = ['chat', 'notification', 'message'] |
| 196 | - lastMessage: '你好,这个商品还在吗?', | 209 | + const type = types[i % 3] |
| 197 | - time: '5分钟前', | 210 | + |
| 198 | - unread: true, | 211 | + mockData.push({ |
| 199 | - type: 'chat' | 212 | + id: i, |
| 200 | - }, | 213 | + name: type === 'notification' ? '系统通知' : type === 'message' ? '客服留言' : `用户${i}`, |
| 201 | - { | 214 | + avatar: type === 'chat' ? `https://randomuser.me/api/portraits/men/${(i % 50) + 1}.jpg` : '', |
| 202 | - id: 2, | 215 | + icon: type === 'notification' ? markRaw(Notice) : type === 'message' ? markRaw(Message) : null, |
| 203 | - name: '李四', | 216 | + lastMessage: type === 'notification' ? '您有新的系统通知' : type === 'message' ? '感谢您的反馈' : `这是第${i}条消息内容`, |
| 204 | - avatar: 'https://randomuser.me/api/portraits/men/32.jpg', | 217 | + time: i <= 5 ? `${i * 5}分钟前` : i <= 10 ? `${i}小时前` : `${i - 10}天前`, |
| 205 | - lastMessage: '价格可以商量吗?', | 218 | + unread: Math.random() > 0.5, |
| 206 | - time: '30分钟前', | 219 | + type: type |
| 207 | - unread: false, | 220 | + }) |
| 208 | - type: 'chat' | 221 | + } |
| 209 | - }, | ||
| 210 | - { | ||
| 211 | - id: 3, | ||
| 212 | - name: '系统通知', | ||
| 213 | - avatar: '', | ||
| 214 | - icon: markRaw(Notice), | ||
| 215 | - lastMessage: '您的商品已通过审核', | ||
| 216 | - time: '1小时前', | ||
| 217 | - unread: true, | ||
| 218 | - type: 'notification' | ||
| 219 | - }, | ||
| 220 | - { | ||
| 221 | - id: 4, | ||
| 222 | - name: '王五', | ||
| 223 | - avatar: 'https://randomuser.me/api/portraits/men/32.jpg', | ||
| 224 | - lastMessage: '[图片]', | ||
| 225 | - time: '2小时前', | ||
| 226 | - unread: true, | ||
| 227 | - type: 'chat' | ||
| 228 | - }, | ||
| 229 | - { | ||
| 230 | - id: 5, | ||
| 231 | - name: '客服留言', | ||
| 232 | - avatar: '', | ||
| 233 | - icon: markRaw(Message), | ||
| 234 | - lastMessage: '感谢您的反馈,我们会尽快处理', | ||
| 235 | - time: '昨天', | ||
| 236 | - unread: false, | ||
| 237 | - type: 'message' | ||
| 238 | - }, | ||
| 239 | - { | ||
| 240 | - id: 6, | ||
| 241 | - name: '张三', | ||
| 242 | - avatar: 'https://randomuser.me/api/portraits/men/32.jpg', | ||
| 243 | - lastMessage: '你好,这个商品还在吗?', | ||
| 244 | - time: '5分钟前', | ||
| 245 | - unread: true, | ||
| 246 | - type: 'chat' | ||
| 247 | - }, | ||
| 248 | - { | ||
| 249 | - id: 7, | ||
| 250 | - name: '李四', | ||
| 251 | - avatar: 'https://randomuser.me/api/portraits/men/32.jpg', | ||
| 252 | - lastMessage: '价格可以商量吗?', | ||
| 253 | - time: '30分钟前', | ||
| 254 | - unread: false, | ||
| 255 | - type: 'chat' | ||
| 256 | - }, | ||
| 257 | - { | ||
| 258 | - id: 8, | ||
| 259 | - name: '系统通知', | ||
| 260 | - avatar: '', | ||
| 261 | - icon: markRaw(Notice), | ||
| 262 | - lastMessage: '您的商品已通过审核', | ||
| 263 | - time: '1小时前', | ||
| 264 | - unread: true, | ||
| 265 | - type: 'notification' | ||
| 266 | - }, | ||
| 267 | - { | ||
| 268 | - id: 9, | ||
| 269 | - name: '王五', | ||
| 270 | - avatar: 'https://randomuser.me/api/portraits/men/32.jpg', | ||
| 271 | - lastMessage: '[图片]', | ||
| 272 | - time: '2小时前', | ||
| 273 | - unread: true, | ||
| 274 | - type: 'chat' | ||
| 275 | - }, | ||
| 276 | - { | ||
| 277 | - id: 10, | ||
| 278 | - name: '客服留言', | ||
| 279 | - avatar: '', | ||
| 280 | - icon: markRaw(Message), | ||
| 281 | - lastMessage: '感谢您的反馈,我们会尽快处理', | ||
| 282 | - time: '昨天', | ||
| 283 | - unread: false, | ||
| 284 | - type: 'message' | ||
| 285 | - }, | ||
| 286 | - ] | ||
| 287 | 222 | ||
| 288 | conversations.value = mockData | 223 | conversations.value = mockData |
| 289 | } | 224 | } |
| ... | @@ -322,13 +257,16 @@ const onTabClick = (tab) => { | ... | @@ -322,13 +257,16 @@ const onTabClick = (tab) => { |
| 322 | 257 | ||
| 323 | // 加载更多数据 | 258 | // 加载更多数据 |
| 324 | const loadMore = async () => { | 259 | const loadMore = async () => { |
| 325 | - if (loading.value || !hasMore.value) return | 260 | + if (loading.value || !hasMore.value) { |
| 261 | + return | ||
| 262 | + } | ||
| 326 | 263 | ||
| 327 | loading.value = true | 264 | loading.value = true |
| 328 | 265 | ||
| 329 | // 模拟API请求 | 266 | // 模拟API请求 |
| 330 | setTimeout(() => { | 267 | setTimeout(() => { |
| 331 | const newData = generateMockData(page.value + 1) | 268 | const newData = generateMockData(page.value + 1) |
| 269 | + | ||
| 332 | if (newData.length > 0) { | 270 | if (newData.length > 0) { |
| 333 | conversations.value.push(...newData) | 271 | conversations.value.push(...newData) |
| 334 | page.value++ | 272 | page.value++ |
| ... | @@ -337,6 +275,8 @@ const loadMore = async () => { | ... | @@ -337,6 +275,8 @@ const loadMore = async () => { |
| 337 | } | 275 | } |
| 338 | loading.value = false | 276 | loading.value = false |
| 339 | }, 1000) | 277 | }, 1000) |
| 278 | + | ||
| 279 | + console.warn('loadMore', page.value, hasMore.value, loading.value); | ||
| 340 | } | 280 | } |
| 341 | 281 | ||
| 342 | // 生成模拟数据 | 282 | // 生成模拟数据 |
| ... | @@ -371,228 +311,244 @@ const onConversationClick = (conversation) => { | ... | @@ -371,228 +311,244 @@ const onConversationClick = (conversation) => { |
| 371 | 311 | ||
| 372 | // 页面加载时初始化数据 | 312 | // 页面加载时初始化数据 |
| 373 | onMounted(() => { | 313 | onMounted(() => { |
| 314 | + // 设置滚动列表可视高度 | ||
| 315 | + const windowHeight = wx.getWindowInfo().windowHeight; | ||
| 316 | + setTimeout(async () => { | ||
| 317 | + const headerHeight = await $('#page-header').height(); | ||
| 318 | + const navHeight = await $('.nut-tabs__list').height(); | ||
| 319 | + scrollStyle.value = { | ||
| 320 | + height: windowHeight - headerHeight - navHeight - 70 + 'px' | ||
| 321 | + } | ||
| 322 | + }, 500); | ||
| 374 | initData() | 323 | initData() |
| 375 | }) | 324 | }) |
| 376 | </script> | 325 | </script> |
| 377 | 326 | ||
| 378 | -<style lang="less" scoped> | 327 | +<style lang="less"> |
| 379 | .messages-page { | 328 | .messages-page { |
| 380 | min-height: 100vh; | 329 | min-height: 100vh; |
| 381 | background-color: #f5f5f5; | 330 | background-color: #f5f5f5; |
| 382 | padding-bottom: 100rpx; | 331 | padding-bottom: 100rpx; |
| 383 | /* 为TabBar留出空间 */ | 332 | /* 为TabBar留出空间 */ |
| 384 | -} | ||
| 385 | 333 | ||
| 386 | -/* 对话列表样式 */ | 334 | + /* 对话列表样式 */ |
| 387 | -.conversation-list { | 335 | + .conversation-list { |
| 388 | - height: calc(100vh - 300rpx); | 336 | + height: calc(100vh - 500rpx); |
| 389 | - background: #ffffff; | 337 | + background: #ffffff; |
| 390 | -} | 338 | + overflow: hidden; |
| 339 | + box-sizing: border-box; | ||
| 340 | + } | ||
| 391 | 341 | ||
| 392 | -.conversation-item { | 342 | + /* 确保scroll-view内容区域正确显示 */ |
| 393 | - padding: 24rpx 20rpx; | 343 | + :deep(.conversation-list) { |
| 394 | - border-bottom: 1rpx solid #f0f0f0; | 344 | + display: block !important; |
| 395 | - transition: background-color 0.2s; | 345 | + } |
| 396 | - margin: 20rpx 0; | ||
| 397 | -} | ||
| 398 | 346 | ||
| 399 | -.avatar-container { | 347 | + .conversation-item { |
| 400 | - display: flex; | 348 | + padding: 24rpx 20rpx; |
| 401 | - align-items: flex-start; | 349 | + border-bottom: 1rpx solid #f0f0f0; |
| 402 | - width: 88rpx; | 350 | + transition: background-color 0.2s; |
| 403 | - margin-right: 24rpx; | 351 | + margin: 20rpx 0; |
| 404 | -} | 352 | + } |
| 405 | 353 | ||
| 406 | -.content-container { | 354 | + .avatar-container { |
| 407 | - padding-left: 8px; | 355 | + display: flex; |
| 408 | -} | 356 | + align-items: flex-start; |
| 357 | + width: 88rpx; | ||
| 358 | + margin-right: 24rpx; | ||
| 359 | + } | ||
| 409 | 360 | ||
| 410 | -.conversation-item:active { | 361 | + .content-container { |
| 411 | - background-color: #f8f9fa; | 362 | + padding-left: 8px; |
| 412 | -} | 363 | + } |
| 413 | 364 | ||
| 414 | -.conversation-item:last-child { | 365 | + .conversation-item:active { |
| 415 | - border-bottom: none; | 366 | + background-color: #f8f9fa; |
| 416 | -} | 367 | + } |
| 417 | 368 | ||
| 418 | -/* 加载指示器 */ | 369 | + .conversation-item:last-child { |
| 419 | -.loading-container { | 370 | + border-bottom: none; |
| 420 | - display: flex; | 371 | + } |
| 421 | - align-items: center; | ||
| 422 | - justify-content: center; | ||
| 423 | - padding: 40rpx; | ||
| 424 | - gap: 16rpx; | ||
| 425 | -} | ||
| 426 | 372 | ||
| 427 | -.loading-text { | 373 | + /* 加载指示器 */ |
| 428 | - font-size: 28rpx; | 374 | + .loading-container { |
| 429 | - color: #9ca3af; | 375 | + display: flex; |
| 430 | -} | 376 | + align-items: center; |
| 377 | + justify-content: center; | ||
| 378 | + padding: 40rpx; | ||
| 379 | + gap: 16rpx; | ||
| 380 | + } | ||
| 431 | 381 | ||
| 432 | -/* Tailwind CSS 类的补充样式 */ | 382 | + .loading-text { |
| 433 | -.w-12 { | 383 | + font-size: 28rpx; |
| 434 | - width: 88rpx; | 384 | + color: #9ca3af; |
| 435 | -} | 385 | + } |
| 436 | 386 | ||
| 437 | -.h-12 { | 387 | + /* Tailwind CSS 类的补充样式 */ |
| 438 | - height: 88rpx; | 388 | + .w-12 { |
| 439 | -} | 389 | + width: 88rpx; |
| 390 | + } | ||
| 440 | 391 | ||
| 441 | -.w-2 { | 392 | + .h-12 { |
| 442 | - width: 8rpx; | 393 | + height: 88rpx; |
| 443 | -} | 394 | + } |
| 444 | 395 | ||
| 445 | -.h-2 { | 396 | + .w-2 { |
| 446 | - height: 8rpx; | 397 | + width: 8rpx; |
| 447 | -} | 398 | + } |
| 448 | 399 | ||
| 449 | -.rounded-full { | 400 | + .h-2 { |
| 450 | - border-radius: 50%; | 401 | + height: 8rpx; |
| 451 | -} | 402 | + } |
| 452 | 403 | ||
| 453 | -.object-cover { | 404 | + // .rounded-full { |
| 454 | - object-fit: cover; | 405 | + // border-radius: 50%; |
| 455 | -} | 406 | + // } |
| 456 | 407 | ||
| 457 | -.bg-gray-100 { | 408 | + .object-cover { |
| 458 | - background-color: #f3f4f6; | 409 | + object-fit: cover; |
| 459 | -} | 410 | + } |
| 460 | 411 | ||
| 461 | -.bg-red-500 { | 412 | + .bg-gray-100 { |
| 462 | - background-color: #ef4444; | 413 | + background-color: #f3f4f6; |
| 463 | -} | 414 | + } |
| 464 | 415 | ||
| 465 | -.flex { | 416 | + .bg-red-500 { |
| 466 | - display: flex; | 417 | + background-color: #ef4444; |
| 467 | -} | 418 | + } |
| 468 | 419 | ||
| 469 | -.flex-1 { | 420 | + .flex { |
| 470 | - flex: 1; | 421 | + display: flex; |
| 471 | -} | 422 | + } |
| 472 | 423 | ||
| 473 | -.flex-shrink-0 { | 424 | + .flex-1 { |
| 474 | - flex-shrink: 0; | 425 | + flex: 1; |
| 475 | -} | 426 | + } |
| 476 | 427 | ||
| 477 | -.min-w-0 { | 428 | + .flex-shrink-0 { |
| 478 | - min-width: 0; | 429 | + flex-shrink: 0; |
| 479 | -} | 430 | + } |
| 480 | 431 | ||
| 481 | -.items-center { | 432 | + .min-w-0 { |
| 482 | - align-items: center; | 433 | + min-width: 0; |
| 483 | -} | 434 | + } |
| 484 | 435 | ||
| 485 | -.justify-center { | 436 | + .items-center { |
| 486 | - justify-content: center; | 437 | + align-items: center; |
| 487 | -} | 438 | + } |
| 488 | 439 | ||
| 489 | -.justify-between { | 440 | + .justify-center { |
| 490 | - justify-content: space-between; | 441 | + justify-content: center; |
| 491 | -} | 442 | + } |
| 492 | 443 | ||
| 493 | -.ml-1 { | 444 | + .justify-between { |
| 494 | - margin-left: 4rpx; | 445 | + justify-content: space-between; |
| 495 | -} | 446 | + } |
| 496 | 447 | ||
| 497 | -.ml-3 { | 448 | + .ml-1 { |
| 498 | - margin-left: 24rpx; | 449 | + margin-left: 4rpx; |
| 499 | -} | 450 | + } |
| 500 | 451 | ||
| 501 | -.mt-1 { | 452 | + .ml-3 { |
| 502 | - margin-top: 4rpx; | 453 | + margin-left: 24rpx; |
| 503 | -} | 454 | + } |
| 504 | 455 | ||
| 505 | -.font-medium { | 456 | + .mt-1 { |
| 506 | - font-weight: 500; | 457 | + margin-top: 4rpx; |
| 507 | -} | 458 | + } |
| 508 | 459 | ||
| 509 | -.text-xs { | 460 | + .font-medium { |
| 510 | - font-size: 24rpx; | 461 | + font-weight: 500; |
| 511 | -} | 462 | + } |
| 512 | 463 | ||
| 513 | -.text-sm { | 464 | + .text-xs { |
| 514 | - font-size: 28rpx; | 465 | + font-size: 24rpx; |
| 515 | -} | 466 | + } |
| 516 | 467 | ||
| 517 | -.text-xl { | 468 | + .text-sm { |
| 518 | - font-size: 40rpx; | 469 | + font-size: 28rpx; |
| 519 | -} | 470 | + } |
| 520 | 471 | ||
| 521 | -.font-bold { | 472 | + .text-xl { |
| 522 | - font-weight: bold; | 473 | + font-size: 40rpx; |
| 523 | -} | 474 | + } |
| 524 | 475 | ||
| 525 | -.text-white { | 476 | + .font-bold { |
| 526 | - color: #ffffff; | 477 | + font-weight: bold; |
| 527 | -} | 478 | + } |
| 528 | 479 | ||
| 529 | -.text-gray-500 { | 480 | + .text-white { |
| 530 | - color: #6b7280; | 481 | + color: #ffffff; |
| 531 | -} | 482 | + } |
| 532 | 483 | ||
| 533 | -.text-gray-600 { | 484 | + .text-gray-500 { |
| 534 | - color: #4b5563; | 485 | + color: #6b7280; |
| 535 | -} | 486 | + } |
| 536 | 487 | ||
| 537 | -.bg-orange-400 { | 488 | + .text-gray-600 { |
| 538 | - background-color: #fb923c; | 489 | + color: #4b5563; |
| 539 | -} | 490 | + } |
| 540 | 491 | ||
| 541 | -.p-4 { | 492 | + .bg-orange-400 { |
| 542 | - padding: 32rpx; | 493 | + background-color: #fb923c; |
| 543 | -} | 494 | + } |
| 544 | 495 | ||
| 545 | -.pt-8 { | 496 | + .p-4 { |
| 546 | - padding-top: 64rpx; | 497 | + padding: 32rpx; |
| 547 | -} | 498 | + } |
| 548 | 499 | ||
| 549 | -.mb-1 { | 500 | + .pt-8 { |
| 550 | - margin-bottom: 4rpx; | 501 | + padding-top: 64rpx; |
| 551 | -} | 502 | + } |
| 552 | 503 | ||
| 553 | -.mb-3 { | 504 | + .mb-1 { |
| 554 | - margin-bottom: 24rpx; | 505 | + margin-bottom: 4rpx; |
| 555 | -} | 506 | + } |
| 556 | 507 | ||
| 557 | -.mr-2 { | 508 | + .mb-3 { |
| 558 | - margin-right: 8rpx; | 509 | + margin-bottom: 24rpx; |
| 559 | -} | 510 | + } |
| 560 | 511 | ||
| 561 | -.truncate { | 512 | + .mr-2 { |
| 562 | - overflow: hidden; | 513 | + margin-right: 8rpx; |
| 563 | - text-overflow: ellipsis; | 514 | + } |
| 564 | - white-space: nowrap; | ||
| 565 | -} | ||
| 566 | 515 | ||
| 567 | -.block { | 516 | + .truncate { |
| 568 | - display: block; | 517 | + overflow: hidden; |
| 569 | -} | 518 | + text-overflow: ellipsis; |
| 519 | + white-space: nowrap; | ||
| 520 | + } | ||
| 570 | 521 | ||
| 571 | -.relative { | 522 | + .block { |
| 572 | - position: relative; | 523 | + display: block; |
| 573 | -} | 524 | + } |
| 574 | 525 | ||
| 526 | + .relative { | ||
| 527 | + position: relative; | ||
| 528 | + } | ||
| 529 | + | ||
| 530 | +} | ||
| 575 | /* NutUI 组件样式覆盖 */ | 531 | /* NutUI 组件样式覆盖 */ |
| 576 | :deep(.nut-searchbar) { | 532 | :deep(.nut-searchbar) { |
| 577 | background: transparent !important; | 533 | background: transparent !important; |
| 578 | } | 534 | } |
| 579 | 535 | ||
| 580 | -:deep(.nut-searchbar .nut-searchbar__search-input) { | 536 | +// :deep(.nut-searchbar .nut-searchbar__search-input) { |
| 581 | - background: #ffffff !important; | 537 | +// background: #ffffff !important; |
| 582 | - border-radius: 40rpx !important; | 538 | +// border-radius: 40rpx !important; |
| 583 | -} | 539 | +// } |
| 584 | 540 | ||
| 585 | -:deep(.nut-tabs) { | 541 | +.nut-tabs { |
| 586 | background: #ffffff; | 542 | background: #ffffff; |
| 587 | } | 543 | } |
| 588 | 544 | ||
| 589 | -:deep(.nut-tabs__titles) { | 545 | +.nut-tabs__titles { |
| 590 | background: #ffffff; | 546 | background: #ffffff; |
| 591 | border-bottom: 1rpx solid #f0f0f0; | 547 | border-bottom: 1rpx solid #f0f0f0; |
| 592 | } | 548 | } |
| 593 | 549 | ||
| 594 | -:deep(.nut-tab-pane) { | 550 | +.nut-tab-pane { |
| 595 | - padding: 0; | 551 | + padding: 0 !important; |
| 596 | } | 552 | } |
| 597 | 553 | ||
| 598 | /* 响应式设计 */ | 554 | /* 响应式设计 */ | ... | ... |
| ... | @@ -2098,6 +2098,11 @@ | ... | @@ -2098,6 +2098,11 @@ |
| 2098 | swiper "11.1.15" | 2098 | swiper "11.1.15" |
| 2099 | tslib "^2.6.2" | 2099 | tslib "^2.6.2" |
| 2100 | 2100 | ||
| 2101 | +"@tarojs/extend@^4.1.3": | ||
| 2102 | + version "4.1.3" | ||
| 2103 | + resolved "https://registry.yarnpkg.com/@tarojs/extend/-/extend-4.1.3.tgz#544bfeca4e7e1c123903dbf4dbafbaaad3600a96" | ||
| 2104 | + integrity sha512-59FQgR36XqPGCwCZjaFHpk2BW5aNUbaf3uPOb8e2W8+yHqHJDWbQcGZtM26fb6xhzjb6tm0KS1DCK5T4V1Xtfw== | ||
| 2105 | + | ||
| 2101 | "@tarojs/helper@4.1.2": | 2106 | "@tarojs/helper@4.1.2": |
| 2102 | version "4.1.2" | 2107 | version "4.1.2" |
| 2103 | resolved "https://registry.yarnpkg.com/@tarojs/helper/-/helper-4.1.2.tgz#34d9d0b78be720b94b18ba71adf0622e930ed807" | 2108 | resolved "https://registry.yarnpkg.com/@tarojs/helper/-/helper-4.1.2.tgz#34d9d0b78be720b94b18ba71adf0622e930ed807" | ... | ... |
-
Please register or login to post a comment