优化代码

This commit is contained in:
aixianling
2023-03-21 11:35:03 +08:00
parent 901fc767fb
commit ebb738e41b

View File

@@ -38,7 +38,8 @@
</div> </div>
</div> </div>
<div class="item-content"> <div class="item-content">
<span hover-stop-propagation v-if="item.themeId" @click.stop="$linkTo('./TopicDetail?themeId=' + item.themeId + '&name=' + item.topicName)">#{{ item.topicName }}</span> <span hover-stop-propagation v-if="item.themeId"
@click.stop="$linkTo('./TopicDetail?themeId=' + item.themeId + '&name=' + item.topicName)">#{{ item.topicName }}</span>
<text>{{ item.content }}</text> <text>{{ item.content }}</text>
</div> </div>
<div class="item-imgs" v-if="item.files.length"> <div class="item-imgs" v-if="item.files.length">
@@ -46,7 +47,8 @@
</div> </div>
<p>{{ item.createTime }}</p> <p>{{ item.createTime }}</p>
<div class="item-bottom"> <div class="item-bottom">
<button hover-stop-propagation @click.stop="onBtnClick" open-type="share" :data-content="item.content" :data-themeid="item.themeId" :data-id="item.id" :data-name="item.topicName"> <button hover-stop-propagation @click.stop="onBtnClick" open-type="share" :data-content="item.content" :data-themeid="item.themeId" :data-id="item.id"
:data-name="item.topicName">
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-zhuanfa.png"/> <image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-zhuanfa.png"/>
<i>{{ item.sharedCount }}</i> <i>{{ item.sharedCount }}</i>
</button> </button>
@@ -188,7 +190,6 @@
this.currIndex = index this.currIndex = index
this.isMore = false this.isMore = false
this.current = 1 this.current = 1
this.$nextTick(() => { this.$nextTick(() => {
this.getList() this.getList()
}) })
@@ -196,10 +197,9 @@
getList() { getList() {
if (this.isMore) return if (this.isMore) return
this.$loading() this.$loading()
this.$instance.post(`/app/appneighborhoodassistance/list`, null, { this.$instance.post(`/app/appneighborhoodassistance/list`, null, {
withoutToken: this.token ? false : true, withoutToken: !this.token,
params: { params: {
current: this.current, current: this.current,
size: 10, size: 10,
@@ -207,7 +207,6 @@
} }
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.$hideLoading()
if (this.current > 1) { if (this.current > 1) {
this.list = [...this.list, ...res.data.records.map(e => { this.list = [...this.list, ...res.data.records.map(e => {
return { return {
@@ -234,9 +233,7 @@
} else { } else {
this.isMore = true this.isMore = true
} }
}).catch(() => { }).finally(() => this.$hideLoading())
this.$hideLoading()
})
} }
}, },