Skip to content
This repository has been archived by the owner on Jun 6, 2019. It is now read-only.

基本属性 #13

Open
pushiming opened this issue Jun 16, 2016 · 3 comments
Open

基本属性 #13

pushiming opened this issue Jun 16, 2016 · 3 comments

Comments

@pushiming
Copy link

pushiming commented Jun 16, 2016

新版中文网站及文档已经上线,请访问 https://weex-project.io/cn/ , 此处后续不再维护,谢谢理解。

基本属性

所有的 weex 标签都有以下的基本属性。

id

id="logo"
id="item-{{index}}"

id 是一个 weex 标签在 <template> 下的唯一标识符。你可以使用 id 属性来引用对应的 weex 标签。

参考关于 id 的更多内容

style

style="width: 200; height: 200"
style="padding: {{x}}; margin: 0"

为 weex 标签增加内联样式。

参考关于 style 的更多内容

class

class="button"
class="button {{btnStatus}}"

为 weex 标签增加类别。

repeat

repeat="{{items}}"

{{items}} 作为循环项,迭代地生成当前的 weex 标签。

参考关于 repeat 的更多内容

if

if="{{opened}}"

{{opened}} 返回一个 boolean 值。若为 true,则显示当前标签;否则不显示。

参考关于 if 的更多内容

append

append="tree/node"

append 属性的可选值为 treenode。不同的值会走不同的渲染过程。

参考关于 append 的更多内容

on... 事件处理

onclick="gotoDetail"
onappear="loadMore"

为当前 weex 标签注册事件处理函数。

参考关于事件处理的更多内容

注意

weex 遵循 HTML attribute 命名规范,所以 不要在属性中使用驼峰风格(CamelCase),使用 - 连接符的 羊肉串风格(kebab-case)才是正确的打开方式

@misakuo
Copy link
Member

misakuo commented Aug 29, 2016

on...事件处理函数中的事件除了上文提到的clickappear以外还有什么?能否枚举一下?

update: found here 通用事件

@yundongbot
Copy link

@misakuo

目前支持

  • click
  • longpress
  • appear
  • disappear

最新的文档和事件列表 http://alibaba.github.io/weex/cn/doc/references/common-event.html

@yundongbot
Copy link

新版中文网站及文档已经上线,请访问 https://weex-project.io/cn/ , 此处后续不再维护,谢谢理解。

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

No branches or pull requests

3 participants