Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
cfc3dd54
Commit
cfc3dd54
authored
Jan 26, 2022
by
刘奕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页优化
parent
23d89942
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
0 deletions
+71
-0
src/utils/tool.js
+34
-0
static/css/skeleton.wxss
+37
-0
No files found.
src/utils/tool.js
0 → 100644
View file @
cfc3dd54
/*函数节流*/
function
throttle
(
fn
,
interval
)
{
var
enterTime
=
0
;
//触发的时间
var
gapTime
=
interval
||
300
;
//间隔时间,如果interval不传,则默认300ms
return
function
()
{
var
context
=
this
;
var
backTime
=
new
Date
();
//第一次函数return即触发的时间
if
(
backTime
-
enterTime
>
gapTime
)
{
fn
.
call
(
context
,
arguments
);
enterTime
=
backTime
;
//赋值给第一次触发的时间,这样就保存了第二次触发的时间
}
};
}
/*函数防抖*/
function
debounce
(
fn
,
interval
)
{
console
.
log
(
'防抖抖~~~'
);
var
timer
;
var
gapTime
=
interval
||
1000
;
//间隔时间,如果interval不传,则默认1000ms
return
function
()
{
clearTimeout
(
timer
);
var
context
=
this
;
var
args
=
arguments
;
//保存此处的arguments,因为setTimeout是全局的,arguments不是防抖函数需要的。
timer
=
setTimeout
(
function
()
{
fn
.
call
(
context
,
args
);
},
gapTime
);
};
}
export
default
{
throttle
,
debounce
};
\ No newline at end of file
static/css/skeleton.wxss
0 → 100644
View file @
cfc3dd54
.skeleton-item{
background: #fff;
position: relative;
overflow: hidden;
border-radius: 0.5px;
}
.skeleton-bg {
background: #f2f3f5;
}
.skeleton-img{
height: 150px;
margin-top: 10px;
}
.skeleton-title{
height: 25px;
margin-top: 10px;
}
.skeleton-detail{
height: 10px;
margin-top: 5px;
}
.skeleton-price{
height: 15px;
margin-top: 5px;
}
.skeleton-animate {
animation: skeleton-blink 1.2s ease-in-out infinite;
}
@keyframes skeleton-blink {
50% {
opacity: 0.6;
}
}
\ No newline at end of file
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