Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat dynamic v2 #1486

Merged
merged 207 commits into from
Jun 27, 2024
Merged

Feat dynamic v2 #1486

merged 207 commits into from
Jun 27, 2024

Conversation

CommanderXL
Copy link
Member

No description provided.

el.ifConditions.push(condition)
}

function getAttrExps (attr) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个方法没有必要了吧

}
}

function processShowStyleDynamic (el, show) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

把processShowStyle也提出来吧,格式统一一点

@@ -1842,6 +1852,12 @@ function processAliAddComponentRootView (el, options) {
el = postProcessComponentIs(el)
}

if (options.runtimeCompile) {
postProcessDynamic(el, config[mode])
processAttrsDynamic(componentWrapView, config[mode])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用新模式处理吧

vnode.attrsList.splice(i, 1)
} else if (attr.value == null) {
const exp = parseMustacheWithContext('{{ true }}').result
attr.__exps = parseExp(exp)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__exps改为__exp吧,现在应该都是单个吧,这里不用parseMustache直接parseExp('true')就可以了吧

}

function postProcessAttrsDynamic (vnode, config) {
const expsMap = Object.fromEntries(vnode.exps?.map(v => ([v.attrName, v])) || [])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exps中的item从设计上讲不一定都有attrName,需要filter一下

const attr = vnode.attrsList[i]
if (config.event.parseEvent(attr.name)) {
// 原本的事件代理直接剔除,主要是基础模版的事件直接走代理形式,事件绑定名直接写死的,优化 astJson 体积
vnode.attrsList.splice(i, 1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里也可以直接调用getAndRemoveAttrs来删除

postMoveBaseDirective(componentWrapView, el, options)

if (options.runtimeCompile) {
processAttrs(componentWrapView, options)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

processAttrs应该在非runtime情况下也需要跑一遍,放在postMoveBaseDirective前面吧

@hiyuki hiyuki merged commit d51138a into didi:master Jun 27, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants