@@ -287,33 +287,33 @@ export function detectAppear (el, visibleData, dir = null, appearOffset) {
287
287
const [ visible , offsetVisible ] = visibleData
288
288
/**
289
289
* No matter it's binding appear/disappear or both of them. Always
290
- * should test it's visibility and change the context/ ._visible.
291
- * If neithor of them was bound, then just ignore it.
290
+ * should test it's visibility and change the el ._visible.
291
+ * If neigher has been bound, then ignore it.
292
292
*/
293
293
/**
294
294
* if the component hasn't appeared for once yet, then it shouldn't trigger
295
295
* a disappear event at all.
296
296
*/
297
297
if ( el . _appearedOnce || visible ) {
298
298
if ( el . _visible !== visible ) {
299
+ el . _visible = visible
300
+ if ( visible && ! el . _appearedOnce ) {
301
+ el . _appearedOnce = true
302
+ }
299
303
const evtName = visible ? 'appear' : 'disappear'
300
304
if ( el . getAttribute ( `data-evt-${ evtName } ` ) === '' ) {
301
- if ( ! el . _appearedOnce ) {
302
- el . _appearedOnce = true
303
- }
304
- el . _visible = visible
305
305
triggerAppearEvent ( el , evtName , dir )
306
306
}
307
307
}
308
308
}
309
309
if ( el . _offsetAppearedOnce || offsetVisible ) {
310
310
if ( el . _offsetVisible !== offsetVisible ) {
311
+ el . _offsetVisible = offsetVisible
312
+ if ( offsetVisible && ! el . _offsetAppearedOnce ) {
313
+ el . _offsetAppearedOnce = true
314
+ }
311
315
const evt = offsetVisible ? [ 'offset-appear' , 'offsetAppear' ] : [ 'offset-disappear' , 'offsetDisappear' ]
312
316
if ( el . getAttribute ( `data-evt-${ evt [ 0 ] } ` ) === '' ) {
313
- if ( ! el . _offsetAppearedOnce ) {
314
- el . _offsetAppearedOnce = true
315
- }
316
- el . _offsetVisible = offsetVisible
317
317
triggerAppearEvent ( el , evt [ 1 ] , dir )
318
318
}
319
319
}
0 commit comments