add:新增search接口
This commit is contained in:
1 parent
ed3ce8ba53
commit
668f57d9ca
3 files changed
+14
-3
No files matched your search
@@ -11,6 +11,12 @@ function getTypeList() {
|
||||
function getArticleList(data: ArticleParams) {
|
||||
return httpClient.get<PageResult<Article>>('/articles', data)
|
||||
}
|
||||
function getSearchRecords() {
|
||||
return httpClient.get<string[]>('/articles/search-records')
|
||||
}
|
||||
function getSearchRecommends() {
|
||||
return httpClient.get<string[]>('/articles/active-search-recommends')
|
||||
}
|
||||
export default {
|
||||
getCarousalList,
|
||||
getTypeList,
|
||||
|
||||
@@ -18,8 +18,10 @@ const props = withDefaults(defineProps<{
|
||||
total: 0,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits(['loadMore'])
|
||||
const loadMoreStatus = computed(() => {
|
||||
return props.pagination.size > props.pagination.total ? 'nomore' : 'more'
|
||||
})
|
||||
const contentText = ref<ContentText>({
|
||||
contentdown: '查看更多',
|
||||
contentrefresh: '加载中',
|
||||
@@ -27,6 +29,9 @@ const contentText = ref<ContentText>({
|
||||
})
|
||||
|
||||
function handleLoadMore() {
|
||||
if (props.pagination.size > props.pagination.total) {
|
||||
return
|
||||
}
|
||||
emit('loadMore')
|
||||
}
|
||||
</script>
|
||||
@@ -50,7 +55,7 @@ function handleLoadMore() {
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<uni-load-more status="more" :content-text="contentText" @click-load-more="handleLoadMore" />
|
||||
<uni-load-more :status="loadMoreStatus" :content-text="contentText" @click-load-more="handleLoadMore" />
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -58,7 +58,7 @@ async function handleClickType(item: Category) {
|
||||
typeList.value.forEach(i => (i.isClick = false))
|
||||
item.isClick = true
|
||||
articleParams.value.categoryId = item.id
|
||||
cardState.value = 'updatePage'
|
||||
cardState.value = 'update'
|
||||
await updateArticleList()
|
||||
}
|
||||
const isSearch = ref<boolean>(true)
|
||||
|
||||
Reference in new issue
Block a user