Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mocp-uniapp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pangchong
mocp-uniapp
Commits
71427ba4
Commit
71427ba4
authored
Jul 30, 2024
by
pangchong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 优化全局组件
parent
139fd963
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
11 deletions
+35
-11
src/mocp/components/global-page-swiper-item/global-page-swiper-item.vue
+6
-1
src/mocp/components/global-page-swiper/global-page-swiper.vue
+29
-10
No files found.
src/mocp/components/global-page-swiper-item/global-page-swiper-item.vue
View file @
71427ba4
...
...
@@ -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]'
)
{
...
...
src/mocp/components/global-page-swiper/global-page-swiper.vue
View file @
71427ba4
...
...
@@ -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
)
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment