Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mall-webview
Project
Project
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
frontend
mall-webview
Commits
173c6eaf
Commit
173c6eaf
authored
Apr 26, 2021
by
wykolor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 拆分组件下拉刷新上拉加载更多
parent
21ea442b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
47 deletions
+74
-47
package.json
package.json
+2
-1
add.vue
src/views/bonus/bonus-detail/add.vue
+17
-46
pullRefreshList.vue
src/views/bonus/components/pullRefreshList.vue
+55
-0
No files found.
package.json
View file @
173c6eaf
...
@@ -61,7 +61,8 @@
...
@@ -61,7 +61,8 @@
"ecmaVersion"
:
2020
"ecmaVersion"
:
2020
},
},
"rules"
:
{
"rules"
:
{
"@typescript-eslint/camelcase"
:
"off"
"@typescript-eslint/camelcase"
:
"off"
,
"@typescript-eslint/no-explicit-any"
:
0
}
}
},
},
"browserslist"
:
[
"browserslist"
:
[
...
...
src/views/bonus/bonus-detail/add.vue
View file @
173c6eaf
<
template
>
<
template
>
<div
class=
"tab-add"
>
<div
class=
"tab-add"
>
<van-pull-refresh
:modelValue=
"paging.refreshing"
@
refresh=
"refresh"
>
<pull-refresh-list
v-slot=
"
{ list }" :request="getBonusList" :paramsFn="paramsFn">
<van-list
<div
v-for=
"item in list"
:key=
"item.id"
class=
"add-item"
>
:modelValue=
"paging.loading"
:finished=
"isFinished"
:finished-text=
"finishText"
@
load=
"loadMore"
>
<div
v-for=
"item in paging.list"
:key=
"item.id"
class=
"add-item"
>
<div
class=
"flex"
>
<div
class=
"flex"
>
<span>
{{
item
.
bizTypeName
}}
</span>
<span>
{{
item
.
bizTypeName
}}
</span>
</div>
</div>
<div
class=
"flex add-item-desc-money
"
>
<div
class=
"flex
"
>
<span
class=
"gray"
>
{{
item
.
creationTime
}}
</span>
<span
class=
"gray"
>
{{
item
.
creationTime
}}
</span>
<label>
+¥
{{
item
.
amountChange
}}
</label>
<label
class=
"desc-money"
>
+¥
{{
item
.
amountChange
}}
</label>
</div>
</div>
</div>
<van-empty
key=
"2"
image=
"search"
v-if=
"paging.error"
:description=
"paging.error"
/>
<van-empty
v-else-if=
"paging.isLoad && paging.total
<
1
"
/>
<div
class=
"list-footer"
>
<van-loading
v-if=
"paging.loading"
color=
"#1989fa"
/>
</div>
</div>
</van-list>
</pull-refresh-list>
</van-pull-refresh>
</div>
</div>
</
template
>
</
template
>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
defineComponent
,
computed
,
onMounted
}
from
"vue"
;
import
{
defineComponent
,
computed
}
from
"vue"
;
import
{
List
,
PullRefresh
,
Empty
,
Loading
}
from
"vant"
;
import
{
usePaging
}
from
"@/util/use-paging"
;
import
{
getBonusList
}
from
"@/server/api/bonus"
;
import
{
getBonusList
}
from
"@/server/api/bonus"
;
import
{
FlowType
,
BizType
}
from
"@/model/bonus/constant"
;
import
{
useStore
}
from
"vuex"
;
import
{
useStore
}
from
"vuex"
;
import
{
useRoute
}
from
"vue-router"
;
import
{
useRoute
}
from
"vue-router"
;
import
PullRefreshList
from
"../components/pullRefreshList.vue"
;
export
default
defineComponent
({
export
default
defineComponent
({
components
:
{
components
:
{
[
List
.
name
]:
List
,
PullRefreshList
[
PullRefresh
.
name
]:
PullRefresh
,
[
Empty
.
name
]:
Empty
,
[
Loading
.
name
]:
Loading
},
},
setup
()
{
setup
()
{
const
route
=
useRoute
();
const
route
=
useRoute
();
const
store
=
useStore
();
const
store
=
useStore
();
const
bonusStoreState
=
computed
(()
=>
store
.
state
.
bonus
);
const
bonusStoreState
=
computed
(()
=>
store
.
state
.
bonus
);
const
paramsFn
=
()
=>
({
const
[
paging
,
loadMore
,
refresh
,
helpers
]
=
usePaging
(
getBonusList
,
()
=>
({
studentId
:
route
.
query
.
studentId
||
bonusStoreState
.
value
.
studentId
,
studentId
:
route
.
query
.
studentId
||
bonusStoreState
.
value
.
studentId
,
flowType
:
"ADD"
flowType
:
"ADD"
}));
});
onMounted
(
refresh
);
return
{
...
helpers
,
paging
,
loadMore
,
refresh
,
FlowType
,
BizType
};
return
{
getBonusList
,
paramsFn
};
}
}
});
});
</
script
>
</
script
>
...
@@ -64,17 +46,6 @@ export default defineComponent({
...
@@ -64,17 +46,6 @@ export default defineComponent({
min-height
:
calc
(
100vh
-
80px
);
min-height
:
calc
(
100vh
-
80px
);
}
}
}
}
.list-footer
{
display
:
flex
;
justify-content
:
center
;
}
// @supports (bottom: constant(safe-area-inset-bottom)) or (bottom: env(safe-area-inset-bottom)) {
// .list-footer {
// padding-bottom: constant(safe-area-inset-bottom);
// padding-bottom: env(safe-area-inset-bottom);
// }
// }
.flex
{
.flex
{
line-height
:
47px
;
line-height
:
47px
;
...
@@ -86,18 +57,18 @@ export default defineComponent({
...
@@ -86,18 +57,18 @@ export default defineComponent({
color
:
#bdc4d1
;
color
:
#bdc4d1
;
font-size
:
24px
;
font-size
:
24px
;
}
}
.add-item
{
.add-item
{
background
:
#fff
;
background
:
#fff
;
margin
:
26px
20px
;
margin
:
26px
20px
;
padding
:
20px
;
padding
:
20px
;
border-radius
:
10px
;
border-radius
:
10px
;
box-shadow
:
0px
10px
20px
0px
rgba
(
221
,
221
,
221
,
0
.3
);
box-shadow
:
0px
10px
20px
0px
rgba
(
221
,
221
,
221
,
0
.3
);
&
-desc-money
{
label
{
}
.desc-money
{
color
:
#f1551e
;
color
:
#f1551e
;
font-size
:
28px
;
font-size
:
28px
;
font-weight
:
600
;
font-weight
:
600
;
}
}
}
}
</
style
>
</
style
>
src/views/bonus/components/pullRefreshList.vue
0 → 100644
View file @
173c6eaf
<
template
>
<van-pull-refresh
:modelValue=
"paging.refreshing"
@
refresh=
"refresh"
>
<van-list
:modelValue=
"paging.loading"
:finished=
"isFinished"
:finished-text=
"finishText"
@
load=
"loadMore"
>
<slot
:list=
"paging.list"
></slot>
<van-empty
key=
"2"
image=
"search"
v-if=
"paging.error"
:description=
"paging.error"
/>
<van-empty
v-else-if=
"paging.isLoad && paging.total
<
1
"
/>
<div
class=
"list-footer"
>
<van-loading
v-if=
"paging.loading"
color=
"#1989fa"
/>
</div>
</van-list>
</van-pull-refresh>
</
template
>
<
script
lang=
"ts"
>
import
{
defineComponent
,
onMounted
,
PropType
}
from
"vue"
;
import
{
PullRefresh
,
List
,
Empty
,
Loading
}
from
"vant"
;
import
{
PagingFunc
,
usePaging
}
from
"@/util/use-paging"
;
export
default
defineComponent
({
components
:
{
[
List
.
name
]:
List
,
[
PullRefresh
.
name
]:
PullRefresh
,
[
Empty
.
name
]:
Empty
,
[
Loading
.
name
]:
Loading
},
props
:
{
request
:
{
type
:
Function
as
PropType
<
PagingFunc
<
object
,
any
>>
,
required
:
true
},
paramsFn
:
{
type
:
Function
as
PropType
<
()
=>
Partial
<
any
>>
}
},
setup
(
props
)
{
const
[
paging
,
loadMore
,
refresh
,
helpers
]
=
usePaging
(
props
.
request
,
props
.
paramsFn
);
onMounted
(
refresh
);
return
{
...
helpers
,
paging
,
loadMore
,
refresh
};
}
});
</
script
>
<
style
lang=
"scss"
scoped
>
.list-footer
{
display
:
flex
;
justify-content
:
center
;
}
</
style
>
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