8000 指令解析优化 by gebilaoxiong · Pull Request #2196 · vuejs/vue · GitHub
[go: up one dir, main page]

Skip to content

指令解析优化 #2196

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

Merged
merged 1 commit into from
Jan 21, 2016
Merged

指令解析优化 #2196

merged 1 commit into from
Jan 21, 2016

Conversation

gebilaoxiong
Copy link
Member

您好。

您的代码非常精彩,分而治之的道理无处不在,以至于在第二遍阅读的时候任然感觉荡气回肠。

另外有个小问题:

在解析v-这种一般指令的时候为什么不用正则将指令名称和参数分离呢。

@@ -22,7 +22,7 @@ import {
// special binding prefixes
const bindRE = /^v-bind:|^:/
const onRE = /^v-on:|^@/
const argRE = /:(.*)$/
const dirAttrRE = /^v-([^:=]+)(?:$|:(.*)$)/
Copy link
Member

Choose a reason for hiding this comment

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

attribute name 不可能有 = 号啊,为啥要避开 = 号

@yyx990803
Copy link
Member

这里的代码是 1.0 时候逐步重构过来的,所以顺着那时候的思路就变这样了。用一个正则确实更简洁一些。多谢!

@yyx990803
Copy link
Member

另外还请最终合并成一个 commit

@gebilaoxiong
Copy link
Member Author

终于回滚正常了,抱歉,git用得不是很熟悉,给你添麻烦了。我马上修改下

@yyx990803
Copy link
Member

你可以 git reset 到最后一个不属于你的 commit,然后重新 commit。之后 git push -f 到你的 fork 即可

@gebilaoxiong gebilaoxiong reopened this Jan 21, 2016
@gebilaoxiong
Copy link
Member Author

好的 我试试

@gebilaoxiong
Copy link
Member Author

感谢。受教了。麻烦您抽空看看

yyx990803 added a commit that referenced this pull request Jan 21, 2016
@yyx990803 yyx990803 merged commit 6002ed2 into vuejs:dev Jan 21, 2016
@yyx990803
Copy link
Member

多谢,期待以后更多的 contribution :)

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.

2 participants
0