【小程序】-- 咨询中心tabs调整

This commit is contained in:
linjinyuan 2022-09-09 16:59:32 +08:00
parent 0a1cf3fb1a
commit bc927846c1
3 changed files with 17 additions and 11 deletions

View File

@ -1,5 +1,5 @@
<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">
<news-card :item="newsItem" :newsId="newsItem.id"></news-card>
</block>
@ -7,7 +7,7 @@
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { ref, watch, nextTick } from 'vue';
import { getArticleList } from "@/api/news"
const props = withDefaults(defineProps < {
@ -19,9 +19,16 @@
})
const paging = ref(null)
const dataList = ref([{
title: '123'
}])
const dataList = ref([])
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) => {
try{

View File

@ -1,10 +1,8 @@
<template>
<view class="news" >
<!-- 搜索 -->
<navigator url="/pages/search/search">
<view class="news-search px-[24rpx] py-[14rpx] bg-white">
<u-search placeholder="请输入关键词搜索" disabled :show-action="false"></u-search>
</view>
<navigator class="news-search px-[24rpx] py-[14rpx] bg-white" url="/pages/search/search">
<u-search placeholder="请输入关键词搜索" disabled :show-action="false"></u-search>
</navigator>
<!-- 内容 -->

View File

@ -50,8 +50,8 @@
import cache from "@/utils/cache"
interface Search {
hot_search: any
his_search: any
hot_search: string[]
his_search:string[]
result: any
searching: boolean
}
@ -82,6 +82,7 @@
search.hot_search = await getHotSearch()
}catch(e){
//TODO handle the exception
console.log('获取热门搜索失败=>', e)
}
}