【小程序】-- 咨询中心tabs调整
This commit is contained in:
parent
0a1cf3fb1a
commit
bc927846c1
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<z-paging ref="paging" v-model="dataList" v-if="i == index" @query="queryList" :fixed="false" height="100%">
|
<z-paging auto-show-back-to-top :auto="i==index" ref="paging" v-model="dataList" :data-key="i" @query="queryList" :fixed="false" height="100%">
|
||||||
<block v-for="(newsItem,newsIndex) in dataList" :key="newsIndex">
|
<block v-for="(newsItem,newsIndex) in dataList" :key="newsIndex">
|
||||||
<news-card :item="newsItem" :newsId="newsItem.id"></news-card>
|
<news-card :item="newsItem" :newsId="newsItem.id"></news-card>
|
||||||
</block>
|
</block>
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from 'vue';
|
import { ref, watch, nextTick } from 'vue';
|
||||||
import { getArticleList } from "@/api/news"
|
import { getArticleList } from "@/api/news"
|
||||||
|
|
||||||
const props = withDefaults(defineProps < {
|
const props = withDefaults(defineProps < {
|
||||||
|
|
@ -19,9 +19,16 @@
|
||||||
})
|
})
|
||||||
|
|
||||||
const paging = ref(null)
|
const paging = ref(null)
|
||||||
const dataList = ref([{
|
const dataList = ref([])
|
||||||
title: '123'
|
const isFirst = ref<boolean>(true)
|
||||||
}])
|
|
||||||
|
watch(() => props.index, async () => {
|
||||||
|
await nextTick()
|
||||||
|
if( props.i == props.index && isFirst.value ) {
|
||||||
|
isFirst.value = false;
|
||||||
|
paging.value?.reload();
|
||||||
|
}
|
||||||
|
}, { immediate: true })
|
||||||
|
|
||||||
const queryList = async (pageNo, pageSize) => {
|
const queryList = async (pageNo, pageSize) => {
|
||||||
try{
|
try{
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="news" >
|
<view class="news" >
|
||||||
<!-- 搜索 -->
|
<!-- 搜索 -->
|
||||||
<navigator url="/pages/search/search">
|
<navigator class="news-search px-[24rpx] py-[14rpx] bg-white" url="/pages/search/search">
|
||||||
<view class="news-search px-[24rpx] py-[14rpx] bg-white">
|
<u-search placeholder="请输入关键词搜索" disabled :show-action="false"></u-search>
|
||||||
<u-search placeholder="请输入关键词搜索" disabled :show-action="false"></u-search>
|
|
||||||
</view>
|
|
||||||
</navigator>
|
</navigator>
|
||||||
|
|
||||||
<!-- 内容 -->
|
<!-- 内容 -->
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,8 @@
|
||||||
import cache from "@/utils/cache"
|
import cache from "@/utils/cache"
|
||||||
|
|
||||||
interface Search {
|
interface Search {
|
||||||
hot_search: any
|
hot_search: string[]
|
||||||
his_search: any
|
his_search:string[]
|
||||||
result: any
|
result: any
|
||||||
searching: boolean
|
searching: boolean
|
||||||
}
|
}
|
||||||
|
|
@ -82,6 +82,7 @@
|
||||||
search.hot_search = await getHotSearch()
|
search.hot_search = await getHotSearch()
|
||||||
}catch(e){
|
}catch(e){
|
||||||
//TODO handle the exception
|
//TODO handle the exception
|
||||||
|
console.log('获取热门搜索失败=>', e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue