Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
business-assistant
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 600e4d39
authored
Apr 04, 2023
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
防抖,吸顶
1 parent
64e60246
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
35 additions
and
23 deletions
pages/tab/output/components/client/client.js
pages/tab/output/components/client/client.json
pages/tab/output/components/client/client.scss
pages/tab/output/components/client/client.wxml
pages/tab/output/components/sortTab/sortTab.scss
pages/tab/output/output.js
utils/util.js
pages/tab/output/components/client/client.js
View file @
600e4d3
...
...
@@ -85,19 +85,11 @@ Component({
},
// 吸顶
handleBusiScroll
(
e
)
{
console
.
log
(
e
)
wx
.
createSelectorQuery
()
.
select
(
'#scroller'
)
.
boundingClientRect
((
res
)
=>
{
console
.
log
(
res
)
this
.
setData
({
stickyScrollTop
:
e
.
detail
.
scrollTop
,
stickyOffsetTop
:
res
.
top
,
});
})
.
exec
();
},
handleBusiScroll
:
wx
.
$util
.
debounce
(
function
(
e
)
{
this
.
setData
({
stickyScrollTop
:
e
?.
detail
?.
scrollTop
})
},
100
),
resetBusiData
()
{
this
.
setData
({
...
...
pages/tab/output/components/client/client.json
View file @
600e4d3
...
...
@@ -5,7 +5,6 @@
"total-tab"
:
"../TotalTab/TotalTab"
,
"busi-card"
:
"../BusiCard/BusiCard"
,
"output-crowdfund"
:
"../outputCrowdfund/outputCrowdfund"
,
"sort-tab"
:
"../sortTab/sortTab"
,
"van-sticky"
:
"@vant/weapp/sticky/index"
"sort-tab"
:
"../sortTab/sortTab"
}
}
\ No newline at end of file
pages/tab/output/components/client/client.scss
View file @
600e4d3
...
...
@@ -42,6 +42,13 @@
}
}
.sort-fix
{
box-sizing
:
border-box
;
position
:
absolute
;
top
:
0
;
left
:
16rpx
;
}
.price-txt
{
// font-family: 'test';
font-weight
:
Bold
;
...
...
pages/tab/output/components/client/client.wxml
View file @
600e4d3
...
...
@@ -62,9 +62,7 @@
<text class="price-txt">¥{{filter.money_three_for_two_thousands(busiObj.totalAmount || 0.00)}}</text>
</view>
<view>
<van-sticky scroll-top="{{ stickyScrollTop }}" offset-top="{{ stickyOffsetTop }}">
<sort-tab id="sortTab" sceneCode="{{formData.sceneCode}}" bindhandleSort="handleSort"></sort-tab>
</van-sticky>
<sort-tab id="sortTab" class="{{stickyScrollTop > 74 ? 'sort-fix' : ''}}" style="top: {{stickyScrollTop - 16 + 'px'}}" sceneCode="{{formData.sceneCode}}" bindhandleSort="handleSort"></sort-tab>
</view>
</view>
<!-- 售后众筹 -->
...
...
pages/tab/output/components/sortTab/sortTab.scss
View file @
600e4d3
...
...
@@ -2,11 +2,12 @@
.sort-tab
{
display
:
flex
;
box-sizing
:
border-box
;
width
:
auto
;
width
:
calc
(
100vw
-
32rpx
)
;
height
:
86rpx
;
line-height
:
86rpx
;
background-color
:
#FFFFFF
;
padding
:
0
20rpx
;
margin-bottom
:
4rpx
;
.title
{
width
:
196rpx
;
...
...
pages/tab/output/output.js
View file @
600e4d3
...
...
@@ -79,12 +79,10 @@ Page({
if
(
e
)
{
this
.
setUserInfo
()
let
clientModule
=
this
.
selectComponent
(
'#client'
)
let
merchantModule
=
this
.
selectComponent
(
'#merchant'
)
console
.
log
(
'clientModule'
,
clientModule
)
// console.log()
// let merchantModule = this.selectComponent('#merchant')
clientModule
.
getClientApi
&&
clientModule
.
clientRefresh
()
clientModule
.
getBusinessData
&&
clientModule
.
getBusinessData
()
merchantModule
.
init
&&
merchantModule
.
init
()
//
merchantModule.init && merchantModule.init()
}
let
{
isSuper
,
userInfo
}
=
this
.
data
console
.
log
(
isSuper
)
...
...
utils/util.js
View file @
600e4d3
...
...
@@ -108,6 +108,22 @@ const throttle = (fn, gapTime) => {
};
};
/* 防抖函数封装 */
function
debounce
(
fn
,
interval
)
{
let
timer
;
let
delay
=
interval
||
1000
;
// 间隔的时间,如果interval不传,则默认1秒
return
function
()
{
let
that
=
this
;
let
args
=
arguments
;
// 保存此处的arguments,因为setTimeout是全局的,arguments不是防抖函数需要的。
if
(
timer
)
{
clearTimeout
(
timer
);
}
timer
=
setTimeout
(
function
()
{
fn
.
apply
(
that
,
args
);
// 用apply指向调用debounce的对象,相当于this.fn(args);
},
delay
);
};
}
/**删除对象里的null值 */
const
clearObjNull
=
(
options
)
=>
{
let
obj
=
{};
...
...
@@ -337,6 +353,7 @@ const Util = {
isFullSucreen
,
clearObjNull
,
throttle
,
debounce
,
isEmptyObj
,
parseString
,
getCurrentPageUrl
,
...
...
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