Weex 快查手册
Weex 备忘录
Native 组件
| 组件 | 特性 | 样式 | 事件 | 特殊父组件 | 子组件 |
|---|---|---|---|---|---|
<div> |
- | box model flexbox positionbackground-coloropacity |
clickappeardisappear |
- | (any) |
<text> |
value |
box model flex positionbackground-coloropacitycolorfont-sizefont-stylefont-weighttext-decorationtext-aligntext-overflowline-height |
clickappeardisappear |
- | text only |
<image> |
src |
box model flexbox positionbackground-coloropacityresize |
clickappeardisappear |
- | (none) |
<scroller> |
show-scrollbarscroll-direction |
box model flexbox positionbackground-coloropacity |
clickappeardisappear |
- | (any) |
<list> |
loadmoreoffset |
box model flexbox positionbackground-coloropacity |
clickappeardisappearloadmorerefreshloading |
- | <cell><header><refresh><loading> |
<cell> |
- | box model flexbox positionbackground-coloropacity |
clickappeardisappear |
<list> |
(any) |
<slider> |
auto-play |
box model flexbox positionbackground-coloropacity |
clickappeardisappearchange |
- | (any)<indicator> |
<indicator> |
- | box model flexbox positionitem-coloritem-selected-coloritem-size |
clickappeardisappear |
<slider> |
(none) |
<wxc-navpage> |
heightbackground-colortitletitle-colorleft-item-titleleft-item-colorright-item-titleright-item-colorleft-item-srcright-item-src |
box model flexbox positionbackground-coloropacity |
clickappeardisappearnaviBar.leftItem.clicknaviBar.rightItem.click |
- | (any) |
<wxc-tabbar> |
tab-items |
box model flexbox positionbackground-coloropacity |
tabBar.onClick |
- | (none) |
<embed> |
src |
box model flexbox positionbackground-coloropacity |
clickappeardisappear |
- | (none) |
<web> |
src |
box model flexbox positionbackground-coloropacity |
clickappeardisappearpagestartpagefinisherror |
- | (none) |
<video> |
srcplay-statusauto-play |
box model flexbox positionbackground-coloropacity |
clickappeardisappearstartpausefinishfail |
- | (none) |
<a> |
href |
box model flexbox positionbackground-coloropacity |
clickappeardisappear |
- | (any) |
<input> |
typevalueplaceholderdisabledautofocus |
box model flexbox positionbackground-coloropacityplaceholder-colorcolorfont-sizefont-stylefont-weighttext-align |
clickappeardisappear |
- | (none) |
<switch> |
checked |
box model flexbox positionbackground-coloropacity |
appeardisappearinputchangefocusblur |
- | (none) |
Native Modules
| module | apis |
|---|---|
@weex-module/dom |
scrollToElement(node, { offset }) |
@weex-module/modal |
toast({ message, duration })alert({ message, okTitle }, callback)confirm({ message, okTitle, cancelTitle }, callback(result))prompt({ message, okTitle, cancelTitle }, callback(result, data)) |
@weex-module/stream |
fetch({ method, url, headers, type, body }, callback({ status, ok, statusText, data, headers }), progressCallback({ readyState, status, length, statusText, headers})) |
@weex-module/webview |
goBack(ref)goForward(ref)reload(ref) |
@weex-module/navigator |
push({ url, animated }, callback)pop({ animated }, callback) |
@weex-module/animation |
transition(node, { styles, duration, timingFunction, delay, transform-origin }, callback) |
特殊的模版语法
<foo x="abc"><foo x=""><foo style="name1: value1; name2: value2"><foo style="name1: value1; name2: ; name3: ..."><foo class="a b c"><foo class="a c"><foo onclick="methodName"><foo id="abc"><foo if="expr"><foo repeat="item in list"><foo repeat="(key,item) in list"><component type="foo"><component type="">
ViewModel APIs
this.$vm(el)this.$el(el)this.$getConfig()this.$emit(type, data)this.$dispatch(type, data)this.$broadcast(type, data)
ViewModel Options
datamethodscomputedinit,created,readyevents
示例:
module.exports = {
data: function () {
return {
x: 1,
y: 2
}
}
methods: {
foo: function () {
console.log('foo')
}
},
computed: {
z: function () {
return this.x + this.y
}
},
events: {
custom: function (e) {
console.log(e)
}
},
init: function () {},
created: function () {},
ready: function () {}
}

浙公网安备 33010602011771号