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

Render 函数翻译疑异 #167

Closed
caolixiang opened this issue Nov 24, 2016 · 0 comments
Closed

Render 函数翻译疑异 #167

caolixiang opened this issue Nov 24, 2016 · 0 comments
Assignees

Comments

@caolixiang
Copy link

原翻译:

template 在这种场景中就表现的有些冗余了。虽然我们重复使用 来接收每一个级别的标题标签,在标题标签中添加相同的锚点元素。但是些都会被包裹在一个无用的 div 中,因为组件必须有根节点。

原文:

That template doesn’t feel great. It’s not only verbose, but we’re duplicating for every heading level and will have to do the same when we add the anchor element. The whole thing is also wrapped in a useless div because components must contain exactly one root node.

翻译意译很多,不够准确。不包含虽然,但是的句式。并不接收标题,仅仅接收描点元素。这个是翻译的错误。

<anchored-heading :level="1">
  <a name="hello-world" href="#hello-world">
    Hello world!
  </a>
</anchored-heading>

替换slot的是这个部分:

 <a name="hello-world" href="#hello-world">
    Hello world!
  </a>

建议:
在这种场景中使用template并不是最好的选择:首先代码冗长,为了在不同级别的标题中插入锚点元素,我们需要重复地使用 <slot></slot>;其次由于组件必须有根节点,标题和锚点元素被包裹在了一个无用的 div 中。

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

No branches or pull requests

2 participants