|
@@ -18,7 +18,7 @@
|
|
|
<view class="notice-time">{{ formatTimestamp(item.insert_time)}}</view>
|
|
|
</view>
|
|
|
|
|
|
- <view class="notice-link" :style="{top: item.isTwoLines ? '67rpx' : '30rpx'}">
|
|
|
+ <view class="notice-link">
|
|
|
<image
|
|
|
class="notice-link-image"
|
|
|
src="https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/05/jYNQJdKYavtqeVoq7bxwYFuF258jFm3sNWVSX1SS.png"
|
|
@@ -57,24 +57,8 @@ export default {
|
|
|
},
|
|
|
onLoad() {
|
|
|
this.handleScroll();
|
|
|
- this.checkTitleLines();
|
|
|
},
|
|
|
methods: {
|
|
|
- checkTitleLines() {
|
|
|
- // 使用setTimeout确保DOM已经渲染完成
|
|
|
- setTimeout(() => {
|
|
|
- this.noticeList.forEach((item, index) => {
|
|
|
- const query = uni.createSelectorQuery().in(this);
|
|
|
- query.select(`.notice-title`).boundingClientRect(data => {
|
|
|
- if (data && data.height > 40) { // 假设单行高度约为40rpx
|
|
|
- this.$set(item, 'isTwoLines', true);
|
|
|
- } else {
|
|
|
- this.$set(item, 'isTwoLines', false);
|
|
|
- }
|
|
|
- }).exec();
|
|
|
- });
|
|
|
- }, 300);
|
|
|
- },
|
|
|
handleScroll() {
|
|
|
// 先销毁之前的观察器
|
|
|
if (this.observer) {
|
|
@@ -172,6 +156,7 @@ export default {
|
|
|
width: 50rpx;
|
|
|
height: 50rpx;
|
|
|
margin-right: 20rpx;
|
|
|
+ top:calc((100% - 50rpx)/2)
|
|
|
}
|
|
|
|
|
|
.notice-link-image,
|