-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(weex): WIP mark recycle list child component root
- Loading branch information
Showing
9 changed files
with
43 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/platforms/weex/compiler/modules/recycle-list/component-root.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* @flow */ | ||
|
||
import { addRawAttr } from 'compiler/helpers' | ||
|
||
// mark component root nodes as | ||
export function preTransformComponentRoot ( | ||
el: ASTElement, | ||
options: WeexCompilerOptions | ||
) { | ||
if (!el.parent) { | ||
// component root | ||
addRawAttr(el, '$isComponentRoot', true) | ||
} | ||
} |
9 changes: 6 additions & 3 deletions
9
src/platforms/weex/compiler/modules/recycle-list/component.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
/* @flow */ | ||
|
||
import { addAttr } from 'compiler/helpers' | ||
import { addRawAttr } from 'compiler/helpers' | ||
import { RECYCLE_LIST_MARKER } from 'weex/util/index' | ||
|
||
// mark components as inside recycle-list so that we know we need to invoke | ||
// their special @render function instead of render in create-component.js | ||
export function postTransformComponent (el: ASTElement, options: WeexCompilerOptions) { | ||
export function preTransformComponent ( | ||
el: ASTElement, | ||
options: WeexCompilerOptions | ||
) { | ||
// $flow-disable-line (we know isReservedTag is there) | ||
if (!options.isReservedTag(el.tag) && el.tag !== 'cell-slot') { | ||
addAttr(el, RECYCLE_LIST_MARKER, true) | ||
addRawAttr(el, RECYCLE_LIST_MARKER, 'true') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters