<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by zhenwu on Medium]]></title>
        <description><![CDATA[Stories by zhenwu on Medium]]></description>
        <link>https://medium.com/@zhenwusw?source=rss-9aeca0fc7efa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*dp2GdvhjnT9SenuO.jpeg</url>
            <title>Stories by zhenwu on Medium</title>
            <link>https://medium.com/@zhenwusw?source=rss-9aeca0fc7efa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 17:33:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zhenwusw/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Weex 文档笔记]]></title>
            <link>https://medium.com/@zhenwusw/weex-%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90%E7%AC%94%E8%AE%B0-b5162c813dd9?source=rss-9aeca0fc7efa------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5162c813dd9</guid>
            <dc:creator><![CDATA[zhenwu]]></dc:creator>
            <pubDate>Mon, 26 Sep 2016 16:21:08 GMT</pubDate>
            <atom:updated>2016-09-26T16:27:03.763Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>概览</strong></p><pre>Weex file --------------frontend(source code)<br>↓ (transform) --------- frontend(build tool)<br>JS bundle ------------- frontend(bundle code)<br>↓ (deploy) ------------ server<br>JS bundle in server --- server<br>↓ (compile) ----------- client(js-engine)<br>Virtual DOM tree ------ client(weex-jsframework)<br>↓ (render) ------------ client(render-engine)<br>Native view ----------- client(render-engine)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*Lw24ATd7vJO5W_Tt28MWGw.png" /></figure><p><strong>三大利器</strong></p><p>Transformer: 先略过</p><p>JS Framework: 安装在客户端，用来管理 Weex instance。从 JS bundle 构建出来的 Weex instance 将用来产生 Virtual DOM Tree。Framework 还负责与本地代码交互，包括视图渲染，调用本地 API，响应用户操作。</p><p>Native Engine: 不同客户端实现不同的 port: iOS/Android/HTML5。但确尽量保持着相同的组件设计，module API 设计，还有渲染机制。所以不同的 port 才能与同一份 JS Framework 和 JS bundle 工作。</p><p><strong>JS Framework</strong></p><p>运行于本地 JavaScript engine。当从服务器获取到 JS bundle 后， define()负责注册所有的 modudles, 然后 bootstrap() 开始将主要的 component 编译成 Virtual Dom，并且发送渲染消息给本地。</p><p>JS 与 Native 的沟通(bridge) 将用到两个方法：</p><ul><li>callNative 使得 JS 端能够调用 Native 代码，代码在 Native 端实现，接口暴露给 JS，Native 端的所有的调用都是按 module 组织的本地 API，例如，rendering, networking, authorizing 还有一些客户端特性如 toast 等。</li><li>callJS 则是在 Native 端调用 JS 端代码。所有代码在 JS 端中实现，然后暴露接口给 Native 端调用。</li></ul><p><strong>Native RenderEngine</strong></p><p>Native RenderEngine 主要提供了众多的本地 compoent 和 module 供 JS 调用。</p><p>Component -&gt; { view, behavior } in the screen。可配置，可响应用户操作，如 &lt;div&gt;， &lt;text&gt;，&lt;image&gt; 等。</p><p>Module 是 API 工具集合，用于 JS 调用本地代码，其中有些用于 HTTP 的异步调用。</p><p>在 Weex instance 运行期间，Native RenderEngine 响应来自于 JS Framework 的 API 调用，用来 create 或者 update 本地 UI。当用户操作本地 UI 时，callJS 被用来调用 JS Framework。</p><p>概括如下图:</p><p><strong>Call native from javascript</strong></p><pre>[JS Framework]<br>↓ callNative<br>module APIs<br>  rendering -&gt; components display<br>  other features<br>[Native RenderEngine]</pre><p><strong>Call javascript from native</strong></p><pre>[Native RenderEngine]<br>module APIs callbacks<br>user interactions<br>↓ callJS<br>[JS Framework]</pre><p><strong>渲染流程</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*cf4BzPTGhegoBDtzCncoXg.png" /></figure><p>上图可见，RenderEngine 的输入端是 Vitual DOM ，输出端是 Native/H5 视图。这个特殊的编译过程包含:</p><ol><li>Build Tree: 将 VDOM 中的 JSON data 解析成 Render Tree(RT)</li><li>Apply Style: 将 CSS 样式应用到 RT 节点中</li><li>Create View: 针对每个 RT 节点创建 Native view</li><li>Attach Event: 将事件回掉 attach 到每个 Native view 上</li><li>CSS Layout: 使用 <a href="https://alibaba.github.io/weex/doc/advanced/how-it-works.html">css-layout</a>计算每个 view 的布局</li><li>Update Frame: 更新每个 Native view 的布局参数</li></ol><h4>参考</h4><p><a href="https://alibaba.github.io/weex/doc/advanced/how-it-works.html">How It Works · Weex</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5162c813dd9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flex 布局笔记]]></title>
            <link>https://medium.com/@zhenwusw/flex-%E5%B8%83%E5%B1%80%E7%AC%94%E8%AE%B0-843ea4bc803a?source=rss-9aeca0fc7efa------2</link>
            <guid isPermaLink="false">https://medium.com/p/843ea4bc803a</guid>
            <dc:creator><![CDATA[zhenwu]]></dc:creator>
            <pubDate>Sat, 24 Sep 2016 16:29:23 GMT</pubDate>
            <atom:updated>2016-09-24T16:29:23.654Z</atom:updated>
            <content:encoded><![CDATA[<p>一、基本知识</p><ul><li>传统盒子模型布局，严重依赖于 display + position + float</li><li>任何一个容器，包括行内容器都可以指定为Flex布局</li><li>设为Flex布局以后，子元素的float、clear和vertical-align属性将失效。</li><li>容器两根轴: 主轴和交叉轴，并不区分方向，但又开始跟结束位置:</li><li>main start, main end, cross start, cross end</li></ul><p>二、容器属性</p><ul><li>flex-direction</li><li>flex-wrap</li><li>flex-flow</li><li>justify-content</li><li>align-items</li><li>align-content</li></ul><p>其中前三个跟主轴有关，分别定义主轴方向，换行，方向+换行，轴向对齐</p><p>align-items 指定交叉轴对齐方式, align-content 指定多轴对齐方式</p><p>三、项目属性</p><ul><li>order</li><li>flex-grow</li><li>flex-shrink</li><li>flex-basis</li><li>flex</li><li>align-self</li></ul><p>order 定义项目的排列顺序。数值越小，排列越靠前，默认为0; flex-grow 定义项目的放大比例，默认为0，即如果存在剩余空间，也不放大; flex-shrink 定义了项目的缩小比例，默认为1，即如果空间不足，该项目将缩小为 0 的属性不缩小; flex-basis 定义了在分配多余空间之前，项目占据的主轴空间（main size）。浏览器根据这个属性，计算主轴是否有多余空间。它的默认值为auto，即项目的本来大小; flex 属性是 flex-grow, flex-shrink, flex-basis 的简写, 默认值为0 1 auto。后两个属性可选; align-self 属性允许单个项目有与其他项目不一样的对齐方式，可覆盖align-items属性。</p><h4>参考:</h4><ol><li><a href="http://www.ruanyifeng.com/blog/2015/07/flex-grammar.html">flex-grammar</a></li><li><a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/">A Complete Guide to Flexbox</a></li><li><a href="https://scotch.io/tutorials/a-visual-guide-to-css3-flexbox-properties">A Visual Guide to CSS3 Flexbox Properties</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=843ea4bc803a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[iOS Design Core Philosophies]]></title>
            <link>https://medium.com/@zhenwusw/ios-design-core-philosophies-391d1d3f2082?source=rss-9aeca0fc7efa------2</link>
            <guid isPermaLink="false">https://medium.com/p/391d1d3f2082</guid>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[zhenwu]]></dc:creator>
            <pubDate>Thu, 30 Jun 2016 14:55:26 GMT</pubDate>
            <atom:updated>2016-06-30T14:55:26.180Z</atom:updated>
            <content:encoded><![CDATA[<h4>Deference</h4><p>Simplify</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*KxBxFBJak-g-sU7uV-qURQ.png" /></figure><p>Maximize content</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*Rt0WeHUy7XU8hbz-H5BXlw.png" /></figure><p>Colors</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*WPp3jSUP7bfjXmzwViD9tw.png" /></figure><p>Typography is content</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*Bx5NVLJnEY0ojQbMb5SDeQ.png" /></figure><p>Negative space</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*HCdE82u2uMgCfY5yFHsDsg.png" /></figure><p>Icon states</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*0A4ISu3Y1HP0J9TOHr-upA.png" /></figure><h4>Clarity</h4><p>Make the text readable</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*IBwrVbot3hm9fko4n0BYGQ.png" /></figure><p>Use obvious icons</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*5DqqbWlkCzadJUVtJuAPUA.png" /></figure><p>Descriptive screens</p><p>Meaning in colors</p><h4>Depth</h4><blockquote>Perhaps the hardest part to understand is depth. It’s a very abstract concept, but at the same time very powerful and unique. Depth is the idea that everything should be contextual and transitional. In real life, when you walk from a room to another, you get a sense of progression and distance. That way you don’t get lost. That same concept should be applied to user interface.</blockquote><p>Transitional interface</p><p>Blurered backgroud</p><p>Make it delightful</p><p>Animation</p><p>Sounds</p><h4>Three rules</h4><p>Design for touch</p><blockquote>Buttons should be easily tappable. Their sizes should be between 30–60pt wide. The optimal size is 44pt. On rare occasions, set to 22pt for links inside texts, but use cautiously as they become hard to tap. Even text buttons have a tappable zone of at least 30pt.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*bLb-8r00XvrL9aP9Yr01HA.png" /></figure><p>Readability</p><p>Adaptive Layout</p><p>Landscape Mode</p><p>San Francisco Font</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*wvyGomggkQdO2W8rrRfoqg.png" /></figure><p>3D touch</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=391d1d3f2082" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>