Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mallapp
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
mallapp
Commits
254f272e
Commit
254f272e
authored
Nov 05, 2021
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
0a687412
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
104 additions
and
0 deletions
+104
-0
NumberAdd.vue
pages/MallMange/components/NumberAdd.vue
+104
-0
No files found.
pages/MallMange/components/NumberAdd.vue
0 → 100644
View file @
254f272e
<
template
>
<view
:class=
"[textColor]"
>
{{
digit
}}
</view>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
speed
:
10
,
digit
:
0
,
};
},
props
:
{
digitTo
:
{
type
:
Number
,
default
:
1000
,
},
digitFrom
:
{
type
:
Number
,
default
:
0
,
},
runTime
:
{
type
:
Number
,
default
:
1000
,
},
digitFiex
:
{
type
:
Number
,
default
:
0
,
},
digitDelay
:
{
type
:
Number
,
default
:
1000
,
},
modeType
:
{
type
:
String
,
default
:
'RANDOM'
},
textColor
:{
type
:
String
,
default
:
'zh_text_black'
}
},
methods
:
{
start
()
{
let
that
=
this
;
that
.
digit
=
that
.
digitFrom
if
(
that
.
modeType
==
"RANDOM"
)
{
var
times
=
that
.
runTime
/
that
.
speed
;
let
i
=
0
;
let
time
=
setInterval
(
function
()
{
var
addVal
=
0
;
if
(
times
==
0
)
{
clearInterval
(
time
);
}
else
if
(
times
==
1
)
{
var
dVal
=
(
that
.
digitTo
-
that
.
digit
)
/
times
;
addVal
=
dVal
;
}
else
{
var
dVal
=
(
that
.
digitTo
-
that
.
digit
)
/
times
;
addVal
=
parseFloat
(
Math
.
random
()
*
dVal
).
toFixed
(
that
.
digitFiex
);
}
that
.
digit
=
(
parseFloat
(
that
.
digit
)
+
parseFloat
(
addVal
)).
toFixed
(
that
.
digitFiex
);
times
--
;
},
that
.
speed
)
}
else
if
(
that
.
modeType
==
"AVERAGE"
)
{
var
times
=
that
.
runTime
/
that
.
speed
;
var
dValue
=
(
that
.
digitTo
-
that
.
digitFrom
)
/
times
;
let
i
=
0
;
let
time
=
setInterval
(
function
()
{
that
.
digit
=
parseFloat
((
that
.
digitFrom
+
dValue
*
i
)).
toFixed
(
that
.
digitFiex
);
if
(
times
==
i
)
{
clearInterval
(
time
);
}
i
++
;
},
that
.
speed
)
}
}
},
created
()
{
let
that
=
this
;
setTimeout
(
function
()
{
that
.
start
();
},
that
.
digitDelay
);
},
watch
:
{
digitTo
(
newVal
,
oldVal
)
{
this
.
digitFrom
=
oldVal
;
this
.
start
();
}
}
}
</
script
>
<
style
>
.zh_text_white
{
color
:
#FFFFFF
;
}
.zh_text_black
{
color
:
#000000
;
}
</
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