Commit 71427ba4 by pangchong

feat: 优化全局组件

parent 139fd963
......@@ -51,6 +51,11 @@ const ps = defineProps({
type: Number,
default: 0
},
//列表的每一项内容是否独立
alone: {
type: Boolean,
default: false
},
//tab数据搜索字段
tabValueField: {
type: String,
......@@ -132,7 +137,7 @@ const queryList = (pageIndex, pageSize) => {
params['pageIndex'] = pageIndex
params['pageSize'] = pageSize
}
if (ps.tabValue != null) {
if (ps.tabValue != null && !ps.alone) {
params[ps.tabValueField] = ps.tabValue
}
if (Object.prototype.toString.call(ps.api) == '[object Function]') {
......
......@@ -11,20 +11,17 @@
<!-- 自定义导航栏 -->
<global-navbar :title="title" v-if="showNavbar" :bgColor="navbgColor" :color="navColor">
<template #left v-if="pages.length > 1 && showNavLeft">
<up-icon v-if="navLeftType == 'icon'" :name="navLeftIcon" size="16" @tap="handleLeftClick"
:color="navColor"></up-icon>
<up-icon v-if="navLeftType == 'icon'" :name="navLeftIcon" size="16" @tap="handleLeftClick" :color="navColor"></up-icon>
<view v-if="navLeftType == 'text'" class="cancel" @tap="handleLeftClick">{{ navLeftText }}</view>
</template>
<template #right v-if="showNavRight">
<global-button type="text" size="small" v-if="navRightType == 'text'" @tap="handleRightClick">
{{ navRightText }}
</global-button>
<global-button type="primary" size="small" v-if="navRightType == 'button'" style="padding: 0 32rpx"
@tap="handleRightClick">
<global-button type="primary" size="small" v-if="navRightType == 'button'" style="padding: 0 32rpx" @tap="handleRightClick">
{{ navRightText }}
</global-button>
<global-icon v-if="navRightType == 'icon'" :icon="navRightIcon"
@tap="handleRightClick"></global-icon>
<global-icon v-if="navRightType == 'icon'" :icon="navRightIcon" @tap="handleRightClick"></global-icon>
</template>
</global-navbar>
<!-- tab切换 -->
......@@ -53,12 +50,13 @@
<global-page-swiper-item
:ref="(vc) => (pagingArr[index] = vc)"
:auto="auto"
:tabValue="tabList[current][valueKey]"
:tabIndex="index"
:tabValue="tabList[current][valueKey]"
:tabValueField="tabValueField"
:currentIndex="current"
:params="params"
:api="api"
:alone="alone"
:params="getParams"
:api="getApi"
:refresher-enabled="refresherEnabled"
:refresher-threshold="refresherThreshold"
:auto-show-back-to-top="autoShowBackToTop"
......@@ -100,7 +98,7 @@
import { computed, nextTick, onUnmounted, ref, watch } from 'vue'
// 获取屏幕边界到安全区域距离
const {safeAreaInsets} = uni.getSystemInfoSync()
const { safeAreaInsets } = uni.getSystemInfoSync()
const es = defineEmits(['handleLeftClick', 'handleRightClick', 'handleFooterClick', 'handleChooseData'])
const ps = defineProps({
background: {
......@@ -120,6 +118,11 @@ const ps = defineProps({
type: Boolean,
default: true
},
//列表的每一项内容是否独立
alone: {
type: Boolean,
default: false
},
//tab数据
tabList: {
type: Array,
......@@ -329,6 +332,22 @@ const swiperTransition = (e) => {}
const swiperAnimationfinish = (e) => {
current.value = e.detail.current
}
//获取查询参数
const getParams = computed(() => {
if (ps.alone) {
ps.tabList[current.value].params || {}
} else {
return ps.params
}
})
//获取查询接口
const getApi = computed(() => {
if (ps.alone) {
ps.tabList[current.value].api
} else {
return ps.api
}
})
//消息提示
const uToastRef = ref()
const openToast = (params) => {
......
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