Skip to content

Commit b204dc2

Browse files
committed
fix triggering appear events for second time when no binding for disappear events.
1 parent 6cbfd90 commit b204dc2

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "weex-vue-render",
33
"description": "Web renderer for weex project written in Vue DSL.",
4-
"version": "1.0.17",
4+
"version": "1.0.18",
55
"license": "Apache-2.0",
66
"main": "dist/index.common.js",
77
"keywords": [

packages/weex-vue-render/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "weex-vue-render",
3-
"version": "1.0.17",
3+
"version": "1.0.18",
44
"description": "Web renderer for weex project written in Vue DSL.",
55
"license": "Apache-2.0",
66
"main": "dist/index.common.js",

src/utils/component.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -287,33 +287,33 @@ export function detectAppear (el, visibleData, dir = null, appearOffset) {
287287
const [visible, offsetVisible] = visibleData
288288
/**
289289
* 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.
292292
*/
293293
/**
294294
* if the component hasn't appeared for once yet, then it shouldn't trigger
295295
* a disappear event at all.
296296
*/
297297
if (el._appearedOnce || visible) {
298298
if (el._visible !== visible) {
299+
el._visible = visible
300+
if (visible && !el._appearedOnce) {
301+
el._appearedOnce = true
302+
}
299303
const evtName = visible ? 'appear' : 'disappear'
300304
if (el.getAttribute(`data-evt-${evtName}`) === '') {
301-
if (!el._appearedOnce) {
302-
el._appearedOnce = true
303-
}
304-
el._visible = visible
305305
triggerAppearEvent(el, evtName, dir)
306306
}
307307
}
308308
}
309309
if (el._offsetAppearedOnce || offsetVisible) {
310310
if (el._offsetVisible !== offsetVisible) {
311+
el._offsetVisible = offsetVisible
312+
if (offsetVisible && !el._offsetAppearedOnce) {
313+
el._offsetAppearedOnce = true
314+
}
311315
const evt = offsetVisible ? ['offset-appear', 'offsetAppear'] : ['offset-disappear', 'offsetDisappear']
312316
if (el.getAttribute(`data-evt-${evt[0]}`) === '') {
313-
if (!el._offsetAppearedOnce) {
314-
el._offsetAppearedOnce = true
315-
}
316-
el._offsetVisible = offsetVisible
317317
triggerAppearEvent(el, evt[1], dir)
318318
}
319319
}

0 commit comments

Comments
 (0)