Commit 03e34e09 authored by Damon's avatar Damon

fix: 【ID1001458】【小程序-首页-试题搜索】:搜索结果页面未默认显示第1个搜索结果的试题的题干、答案、解析

parent 22d2771b
......@@ -31,6 +31,7 @@
v-for="(item, index) in section"
:key="index"
:begin="item.begin"
:arrId.sync="arrId"
:end="item.end"
></my-section>
<u-loadmore :status="loadStatus" :margin-bottom="40" />
......@@ -49,7 +50,7 @@
</template>
<script>
import { list } from './list.js'
import { getList, setList } from './list.js'
import mySection from './my-section.vue'
export default {
components: {
......@@ -66,11 +67,13 @@ export default {
isLoadMore: false, //是否加载中
total: 0,
section: [],
arrId: ''
}
},
onLoad(e) {
this.keyword = e ? decodeURIComponent(e.keyword) : ''
this.lists = list
setList([])
this.lists = getList()
},
onReady() {
this.init()
......@@ -137,6 +140,7 @@ export default {
begin: this.lists.length - records.length,
end: this.lists.length,
})
this.arrId = this.lists[0].id
if (records.length < this.pageSize) {
//判断接口返回数据量小于请求数据量,则表示此为最后一页
......@@ -159,7 +163,9 @@ export default {
this.$u.vuex('searchHistory', history)
this.currentPage = 1
this.lists = []
setList([])
this.section = []
this.arrId = ''
this.init()
}
}
......
export const list = []
\ No newline at end of file
let list = []
export function setList(lists) {
list = lists
}
export function getList() {
return list
}
\ No newline at end of file
......@@ -13,14 +13,14 @@
</template>
<script>
import { list } from './list.js'
import { getList } from './list.js'
import searchItem from '@/components/search-item/index.vue'
export default {
components: {
searchItem,
},
props: ['begin', 'end'],
props: ['begin', 'end', 'arrId'],
data() {
return {
list: [],
......@@ -28,7 +28,9 @@ export default {
}
},
created() {
const list = getList()
this.list = list.slice(this.begin, this.end)
if(this.arrId) this.arrIndex = this.arrId
},
methods: {
arrowDown(e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment