how to use onPageScroll, in WeChat Mini Programs Custom component I set the value in properties in the component when I need onPageScroll.
how to use onPageScroll, in WeChat Mini Programs Custom component I set the value in properties in the component when I need onPageScroll.
has gone through the latest development documentation, and there are a few issues that need to be confirmed.
1 according to your problem, it is preliminarily determined that onPageScroll
is not triggered in the component, it may be that this event is only registered in Page
if this is the case, then consider to achieve it in the component through other methods.
2 visual observation that your requirement is to do a component, which is universal to the page, is displayed when the scrolling value of the current page is greater than 600, and click to make the page scroll to the top correctly.
3 then consider using WXML node information API
. After just doing it, it should be able to meet the needs of your component. Get the scrolltop value of the corresponding page in the component to execute the corresponding method.
Brother, where is res, let top=res.scrollTop;? According to the way you write it, res is the parameter value passed by onPageScroll, so it should be onPageScoll (res) {.}
onPageScroll(scrollTop){
console.log(scrollTop)
}
Note that scroll-view
affects the hook function above.
<view class= a > <text> Hello {{name}}!< text> <block wx:for= {{datas}} wx:key= u > <button data-index= {{index}} class= {{index==id?classname:""}} data-m= {{t==index}} bindtap="changeName...
for the business needs of the company, the details section of a page of Mini Program is the html tag edited by the rich text editor returned from the API, and the image matches the text. I originally thought that Mini Program did not recognize the html t...
as shown in the figure above, a string is sent back in the background. How to highlight the number? ...
it is in the middle on the Android, but it is crooked with the Apple 6 test. It doesn t work with either of the following. display: flex; justify-content: center; align-items: center; text-align: center; ...
problem description recently I was contacting and writing Mini Program, and I encountered a problem. I don t know why, that is, I render the data to the foreground page in the developer s tool, which is normal in the developer s tool, but it s not...
I now use Mini Program touch start events bindtouchstart and bind:touchend as press and release events, but to make certain restrictions, if a single point is not implemented, how to limit ah? startRecord: function(e) { console.log( ) ...
formSubmit formSubmit e { this.triggerEvent( formSubmit ) } <son-form bindsubmit="formSubmit">< son-form> formSubmit formSubmit e { console.log(1) } ...
1. For example, in the tab switching page like the following, the method I use now is to click the current option to call the API, such as click all to call, click to withdraw and call once, but this will waste the interface. What I want to do now is to...
<i-input value="{{ number }}"> <input value="{{ value }}"> properties:{ value: Sting } valuenumber valuenumber ...
because Mini Program s router cannot display content in part of the page like vue-router, it is necessary to use eventbus when doing the bottom navigation bar, and Wechat wx:if, for the middle content, but wx:if will make the component s hook function ...
Why is the following sentence wrong? wx.getBackgroundAudioManager().src = http: music.163.com song media outer url?id=29719651.mp3 ...
getStorage-22...
getMenuInfo () { wx.request({ url: https: appdb.hsltm.com wxapi-web indexPageDiaryCategory , data: {}, method: get , header: { content-type : application json }, success: function (res) { if (res.data == 0) { co...