Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

Commit 7b89edd

Browse files
committed
v0.0.6修复部分图标路径问题、滚动防抖bug修复
1 parent 13560de commit 7b89edd

File tree

15 files changed

+31
-21
lines changed

15 files changed

+31
-21
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ API来自于[cnode社区](https://cnodejs.org/api)
1111
![](./img/show.jpg)
1212

1313
线上版本更新日志
14+
v0.0.6 修复部分图标路径问题、滚动防抖bug修复
15+
1416
v0.0.5 修复帖子详情滑动卡顿问题 首页栏目切换动画修复 部分图标修复
1517

1618
v0.0.4 修复几处样式,添加帖子热帖,发帖添加markdown预览,通知添加一键已读和点击已读 markdown发布的预览

src/main.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,23 @@ export default {
2323
list: [{
2424
pagePath: 'pages/index/main',
2525
text: '首页',
26-
iconPath:'./static/home.png',
27-
selectedIconPath:'./static/home.png'
26+
iconPath:'static/home.png',
27+
selectedIconPath:'static/home.png'
2828
}, {
2929
pagePath: 'pages/notice/main',
3030
text: '通知',
31-
iconPath:'./static/notice-o.png',
32-
selectedIconPath:'./static/notice-o.png'
31+
iconPath:'static/notice-o.png',
32+
selectedIconPath:'static/notice-o.png'
3333
}, {
3434
pagePath: 'pages/publish/main',
3535
text: '发帖',
36-
iconPath:'./static/edit.png',
37-
selectedIconPath:'./static/edit.png'
36+
iconPath:'static/edit.png',
37+
selectedIconPath:'static/edit.png'
3838
}, {
3939
pagePath: 'pages/me/main',
4040
text: '我',
41-
iconPath:'./static/user-o.png',
42-
selectedIconPath:'./static/user-o.png'
41+
iconPath:'static/user-o.png',
42+
selectedIconPath:'static/user-o.png'
4343
}]
4444
},
4545
}

src/pages/detail/index.vue

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<img class='author-img' :src='detailData.author && detailData.author.avatar_url' alt="头像">
88
<span class='name'>{{detailData.author&& detailData.author.loginname}}</span>
99
</div>
10-
<div class='list'><img @click.stop="collect" :src="detailData.is_collect?'../../static/star2.png':'../../static/star1.png'" style='width:40rpx;height:40rpx;'><span>楼主</span></div>
10+
<div class='list'><img @click.stop="collect" :src="detailData.is_collect?'/static/star2.png':'/static/star1.png'" style='width:40rpx;height:40rpx;'><span>楼主</span></div>
1111
</div>
1212
<scroll-view class='body' scroll-y='true' @scroll='onScroll($event)' :scroll-top="top" enable-back-to-top='true' @scrolltolower='getMore'>
1313
<div class='title'>
@@ -18,7 +18,7 @@
1818
<span>评论:{{detailData.reply_count}}</span>
1919
</div>
2020
</div>
21-
<img class='up-png' src="../../static/up.png" mode='widthFix' @click.stop="goTop">
21+
<img class='up-png' src="/static/up.png" mode='widthFix' @click.stop="goTop">
2222
<div v-if='!sendVisible' class='reply-buton' @click.stop="showReplyModal">评论</div>
2323
<div class='content'>
2424
<wemark :mdData='detailData.content'></wemark>
@@ -37,8 +37,8 @@
3737
<wemark :mdData='item.content'></wemark>
3838
</p>
3939
<div class='foot'>
40-
<div :data-replyid='item.id' :data-originindex='originindex' @click.stop="upOrCancel($event)"><img class='icon' :src="(!item.is_uped)?'../../static/good1.png':'../../static/good2.png'" /><span>点赞:{{item.ups.length}}</span></div>
41-
<div :data-loginname='item.author.loginname' @click.stop="showReplyModal($event)" :data-replyid='item.id'><img class='icon' src='../../static/chat.png' /><span>回复</span></div>
40+
<div :data-replyid='item.id' :data-originindex='originindex' @click.stop="upOrCancel($event)"><img class='icon' :src="(!item.is_uped)?'/static/good1.png':'/static/good2.png'" /><span>点赞:{{item.ups.length}}</span></div>
41+
<div :data-loginname='item.author.loginname' @click.stop="showReplyModal($event)" :data-replyid='item.id'><img class='icon' src='/static/chat.png' /><span>回复</span></div>
4242
</div>
4343
</div>
4444
</div>
@@ -49,9 +49,12 @@
4949

5050
<script>
5151
import { api } from "../../const";
52-
import { passTime } from "../../utils";
52+
import { passTime, debounce} from "../../utils";
5353
import sendReply from "../../components/sendReply";
5454
import wemark from "mpvue-wemark";
55+
const debounceOnScroll = () => debounce(function(e){
56+
this.top = e.target.scrollTop
57+
});
5558
export default {
5659
components: {
5760
wemark,
@@ -75,12 +78,7 @@ export default {
7578
},
7679
7780
methods: {
78-
onScroll(e) {
79-
if (this.timer){
80-
clearTimeout(this.timer);
81-
this.timer = setTimeout(() =>this.top = e.target.scrollTop,500)
82-
}
83-
},
81+
onScroll : debounceOnScroll(),
8482
async getData() {
8583
const accesstoken = wx.getStorageSync("accesstoken");
8684
//this.id = wx.getStorageSync("topicid");
@@ -135,8 +133,7 @@ export default {
135133
},
136134
goTop() {
137135
// console.log(11);
138-
setTimeout(() => (this.top = 0));
139-
this.top = 1;
136+
this.top = 0;
140137
},
141138
getMore() {
142139
if (this.remainReplies.length > 0) {

src/utils/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,14 @@ export function passTime(time) {
4343
export function getURL() {
4444
return getCurrentPages().slice(-1)[0].route
4545
}
46+
47+
48+
export function debounce(fn, interval = 300) {
49+
let timeout = null;
50+
return function () {
51+
clearTimeout(timeout);
52+
timeout = setTimeout(() => {
53+
fn.apply(this, arguments);
54+
}, interval);
55+
};
56+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)