Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
gh
/
data-view
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4a3dc0eb
authored
Jun 23, 2022
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
增加跑马灯
1 parent
1cfff723
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
2 deletions
src/components/Marquee.vue
src/components/ViewControl.vue
src/mixins/changeMixin.js
src/components/Marquee.vue
0 → 100644
View file @
4a3dc0e
<
template
>
<div
class=
"marquee-box"
ref=
"marqueeBox"
>
<span
class=
"marquee"
ref=
"marqueeText"
:style=
"[
{'transition': `all ${move ? speed : 0}s linear`},{'left':target}]"
>
{{
text
}}
</span>
</div>
</
template
>
<
script
type=
'text/ecmascript-6'
>
export
default
{
name
:
'Marquee'
,
props
:
{
text
:
String
,
direction
:
{
type
:
Number
,
default
:
5000
},
delay
:
{
type
:
Number
,
default
:
0
}
},
data
()
{
return
{
move
:
false
,
valueWidth
:
0
,
target
:
0
,
boxWidth
:
0
,
speed
:
0
}
},
mounted
()
{
setTimeout
(()
=>
{
let
{
marqueeBox
,
marqueeText
}
=
this
.
$refs
let
boxWidth
=
marqueeBox
.
offsetWidth
,
valueWidth
=
marqueeText
.
offsetWidth
this
.
valueWidth
=
valueWidth
this
.
boxWidth
=
boxWidth
if
(
boxWidth
-
20
<=
valueWidth
)
this
.
run
(
valueWidth
)
},
this
.
delay
)
},
methods
:
{
run
()
{
let
{
valueWidth
,
direction
}
=
this
this
.
target
=
`-
${
valueWidth
}
px`
this
.
move
=
true
this
.
speed
=
direction
/
1000
setTimeout
(()
=>
{
this
.
again
()
},
direction
)
},
again
()
{
let
{
boxWidth
,
valueWidth
,
direction
}
=
this
this
.
move
=
false
this
.
target
=
`
${
boxWidth
}
px`
setTimeout
(()
=>
{
this
.
speed
=
direction
*
(
boxWidth
/
valueWidth
).
toFixed
(
2
)
/
1000
this
.
move
=
true
this
.
reset
()
},
500
)
},
reset
()
{
let
awaitTime
=
(
this
.
speed
+
2
)
*
1000
this
.
target
=
0
setTimeout
(()
=>
{
this
.
run
()
},
awaitTime
)
}
}
}
</
script
>
<
style
scoped
lang=
'scss'
>
.marquee-box
{
width
:
100%
;
height
:
100%
;
overflow
:
hidden
;
position
:
relative
;
.marquee
{
position
:
absolute
;
white-space
:
nowrap
;
display
:
flex
;
align-items
:
center
;
}
.move
{
transform
:
translateX
(
-100%
);
}
}
</
style
>
\ No newline at end of file
src/components/ViewControl.vue
View file @
4a3dc0e
...
...
@@ -68,7 +68,6 @@ export default {
mounted
()
{
test
.
map
(
e
=>
e
.
active
=
false
)
this
.
brands
=
test
console
.
log
(
this
.
$store
)
},
methods
:
{
change
(
index
,
item
)
{
...
...
src/mixins/changeMixin.js
View file @
4a3dc0e
...
...
@@ -3,7 +3,7 @@ export default {
watchReportParams
:
{
immediate
:
true
,
handler
(
newval
)
{
this
.
init
()
//
this.init()
}
}
},
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment