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

san-ssr 对空值属性的渲染和 san 原生渲染有 diff #5

Closed
l5oo00 opened this issue Oct 31, 2019 · 2 comments
Closed

san-ssr 对空值属性的渲染和 san 原生渲染有 diff #5

l5oo00 opened this issue Oct 31, 2019 · 2 comments
Assignees
Labels

Comments

@l5oo00
Copy link
Contributor

l5oo00 commented Oct 31, 2019

RT, 使用中发现如下 diff:

<!-- san template -->
<div a1="{{''}}" a2="{{null}}" a3="{{false}}" a4="{{undefined}}" a5="{{0}}" a6="{{[]}}" a7="{{true}}" a8="{{}}" a9>属性绑定元素载体</div>

<!-- san 渲染出的 html -->
<div a8="{{}}" a1="" a2="" a3="false" a4="" a5="0" a6="" a7="true" a9="">属性绑定元素载体</div>


<!-- san-ssr 渲染出的 html -->
<div a7="true">属性绑定元素载体</div>

可参考这个在线 Demo: https://codesandbox.io/embed/san-demo-dvnpb@harttle 看看是否需要对齐?


另外, 其实我真正的需求是希望能有一种方法能渲染出以下两种结果:

  • 跟据条件判断确定属性是否可以不渲染

    san 的属性整体绑定 已支持, 单个属性绑定暂不支持

  • 跟据条件判断确定属性要么不渲染, 要么只渲染属性名(相当于 HTML 里的布尔属性)

    san 暂时不支持

已经给 san 提 issue 了, @harttle 看看 san-ssr 是否可以先自行实现这两个功能。

@harttle harttle self-assigned this Oct 31, 2019
@harttle
Copy link
Member

harttle commented Nov 4, 2019

san-ssr 先对齐 san 客户端渲染结果,后续两个问题从 san 核心仓库来跟进。

@harttle harttle closed this as completed in 015c594 Nov 4, 2019
harttle pushed a commit that referenced this issue Nov 4, 2019
# [1.1.0](v1.0.5...v1.1.0) (2019-11-04)

### Bug Fixes

* '../' syntax in component files, close [#4](#4) ([ce423a5](ce423a5))
* ssr/csr difference respect to falsy attributes, closes [#5](#5) ([015c594](015c594))

### Features

* support ts2php modules config, close [#8](#8) ([c5a0c17](c5a0c17))
@harttle
Copy link
Member

harttle commented Nov 4, 2019

🎉 This issue has been resolved in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants