Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
ec-report-refactor
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
lihuizhen
ec-report-refactor
Commits
0e3617fd
Commit
0e3617fd
authored
Feb 24, 2022
by
Jenny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 数字滚动修改
parent
5ac58102
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
30 deletions
+24
-30
CountTo.vue
components/CountTo/CountTo.vue
+24
-30
No files found.
components/CountTo/CountTo.vue
View file @
0e3617fd
<
template
>
<view
class=
"count-to"
:style=
"
{height: `${height}px`,}">
<NormalTitle
:elementInfo=
"elementInfo"
></NormalTitle>
<!-- warning:count-to的font-size单位为rpx -->
<u-count-to
:start-val=
"startVal"
:end-val=
"endVal"
:duration=
"duration"
separator=
","
:color=
"elementInfo.option.countTo.color"
:font-size=
"getFontSize()"
></u-count-to>
<view
class=
"count-to"
:style=
"
{
backgroundColor: elementInfo.option.countTo.backgroundColor
}">
<NormalTitle
:elementInfo=
"elementInfo"
></NormalTitle>
<u-count-to
:start-val=
"startVal"
:end-val=
"endVal"
:duration=
"duration"
separator=
","
:color=
"elementInfo.option.countTo.color"
:font-size=
"getFontSize()"
></u-count-to>
</view>
</
template
>
...
...
@@ -15,15 +23,9 @@
return
{
startVal
:
0
,
endVal
:
0
,
height
:
0
,
duration
:
2000
};
},
onReady
()
{
this
.
getComponentHeight
()
},
},
methods
:
{
initChart
()
{
this
.
$nextTick
(()
=>
{
...
...
@@ -34,31 +36,23 @@
}
})
},
// 计算组件高度
getComponentHeight
()
{
const
{
windowWidth
}
=
uni
.
getSystemInfoSync
()
this
.
height
=
this
.
elementInfo
.
height
if
(
this
.
elementInfo
.
width
>
windowWidth
)
{
this
.
height
=
this
.
elementInfo
.
height
/
this
.
elementInfo
.
width
*
windowWidth
}
},
getFontSize
()
{
return
this
.
$u
.
common
.
pxToRpx
(
this
.
elementInfo
.
option
.
countTo
.
fontSize
)
}
},
}
}
</
script
>
<
style
>
.count-to
{
font-size
:
30px
;
color
:
#f9bb70
;
font-weight
:
bold
;
text-align
:
center
;
width
:
100%
;
.count-to
{
width
:
100%
;
height
:
100%
;
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
font-size
:
30px
;
color
:
#f9bb70
;
font-weight
:
bold
;
text-align
:
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