Commit 03e34e09 authored by Damon's avatar Damon

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

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