Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pptist
Project
Project
Details
Activity
Releases
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
viitto
pptist
Commits
8e1443f1
Commit
8e1443f1
authored
Feb 27, 2024
by
zhengke
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.2.0' of
http://gitlab.oytour.com/viitto/pptist
into 1.2.0
parents
1e785965
83973be2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
3 deletions
+52
-3
index.ts
src/plugins/directive/index.ts
+2
-0
loadMore.ts
src/plugins/directive/loadMore.ts
+39
-0
Share.vue
src/views/SellTemplate/Share.vue
+11
-3
No files found.
src/plugins/directive/index.ts
View file @
8e1443f1
...
...
@@ -3,11 +3,13 @@ import type { App } from 'vue'
import
Contextmenu
from
'./contextmenu'
import
ClickOutside
from
'./clickOutside'
import
Tooltip
from
'./tooltip'
import
LoadMore
from
'./loadMore'
export
default
{
install
(
app
:
App
)
{
app
.
directive
(
'contextmenu'
,
Contextmenu
)
app
.
directive
(
'click-outside'
,
ClickOutside
)
app
.
directive
(
'tooltip'
,
Tooltip
)
app
.
directive
(
'load-more'
,
LoadMore
)
}
}
src/plugins/directive/loadMore.ts
0 → 100644
View file @
8e1443f1
import
{
Directive
,
DirectiveBinding
}
from
"vue"
const
CTX_SCROLL_LOADMORE_HANDLER
=
'CTX_SCROLL_LOADMORE_HANDLER'
let
LAST_TRIGGER_EVENT
=
0
interface
CustomHTMLElement
extends
HTMLElement
{
[
CTX_SCROLL_LOADMORE_HANDLER
]?:
(
event
:
Event
)
=>
void
}
const
callbackEvent
=
(
event
:
any
,
binding
:
DirectiveBinding
<
any
>
)
=>
{
const
that
=
event
.
target
if
(
that
.
scrollHeight
-
Math
.
ceil
(
that
.
scrollTop
)
-
that
.
clientHeight
<=
3
){
if
(
LAST_TRIGGER_EVENT
==
0
||
(
new
Date
()).
getTime
()
-
LAST_TRIGGER_EVENT
>=
300
){
binding
.
value
()
LAST_TRIGGER_EVENT
=
(
new
Date
()).
getTime
()
}
}
}
const
LoadMoreDirective
:
Directive
=
{
mounted
(
el
:
CustomHTMLElement
,
binding
)
{
let
obj
=
el
.
querySelector
(
'.el-scrollbar__wrap'
)
if
(
obj
){
console
.
log
(
'找到元素'
)
el
[
CTX_SCROLL_LOADMORE_HANDLER
]
=
(
event
:
Event
)
=>
callbackEvent
(
event
,
binding
)
obj
.
addEventListener
(
'scroll'
,
el
[
CTX_SCROLL_LOADMORE_HANDLER
])
}
else
{
console
.
log
(
'没有找到元素'
)
}
},
unmounted
(
el
:
CustomHTMLElement
)
{
if
(
el
[
CTX_SCROLL_LOADMORE_HANDLER
])
{
document
.
removeEventListener
(
'scroll'
,
el
[
CTX_SCROLL_LOADMORE_HANDLER
])
delete
el
[
CTX_SCROLL_LOADMORE_HANDLER
]
}
},
}
export
default
LoadMoreDirective
\ No newline at end of file
src/views/SellTemplate/Share.vue
View file @
8e1443f1
...
...
@@ -29,7 +29,7 @@
</div>
</div>
<div
class=
"col full-width q-ml-md"
>
<el-table
class=
"sample-table"
:data=
"data"
style=
"width: 100%"
height=
"100%"
v-loading=
"loading"
@
sort-change=
"sortHandler"
:default-sort=
"
{ prop: 'CreateTime', order: 'descending' }">
<el-table
class=
"sample-table"
v-load-more=
"tableScrollHandler"
:data=
"data"
style=
"width: 100%"
height=
"100%"
v-loading=
"loading"
@
sort-change=
"sortHandler"
:default-sort=
"
{ prop: 'CreateTime', order: 'descending' }">
<!--
<el-table-column
type=
"selection"
width=
"20"
/>
-->
<el-table-column
className=
"indentLeft"
>
<template
#
header
>
...
...
@@ -225,8 +225,9 @@ const clearNavigationHandler = async () => {
await
refreshHandler
()
}
const
refreshHandler
=
async
()
=>
{
queryObj
.
pageIndex
=
0
queryObj
.
pageCount
=
0
queryObj
.
pageIndex
=
1
queryObj
.
pageCount
=
1
pageCount
.
value
=
1
data
.
value
=
[]
refreshLoading
.
value
=
true
await
getDocumentData
()
...
...
@@ -288,6 +289,13 @@ const checkPositionHandler = (n:any)=>{
emit
(
'destroy-position'
)
}
}
const
tableScrollHandler
=
()
=>
{
console
.
log
(
'share 通知到底底部'
)
if
(
pageCount
.
value
>
queryObj
.
pageIndex
){
queryObj
.
pageIndex
++
getDocumentData
()
}
}
watch
(()
=>
props
.
position
,(
n
,
o
)
=>
{
if
(
n
){
...
...
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