weex APIs

Posted L先森

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了weex APIs相关的知识,希望对你有一定的参考价值。

1.通过这个$vm()上下文访问这些api在脚本的方法

<script>
module.exports = {
    methods: {
        somemethod: function() {
            this.$vm(someId);
        }
    }
}
</script>

1.1 $(id)

已过时, 使用 $vm .

1.2 $el(id)

返回元素引用的特定的id

1.3 $getConfig()

获取当前全局环境变量和配置信息

  • config(object): the object of config.
  • bundleUrl(string): the url of bundle.
  • debug(boolean): if is debug mode.
  • env(object): a object of envrioment.
    • weexVersion(string): a version of weex sdk.
    • appName(string): a name of app.
    • appVersion(string): a version of app.
    • platform(string): the platform, one of iosandroid and Web.
    • osVersion(string): the version of os.
    • deviceModel(string): the model of device. native only
    • deviceWidth(number): the width of device, default is 750.
    • deviceHeight(number): the height of device.

 

以上是关于weex APIs的主要内容,如果未能解决你的问题,请参考以下文章

weex官方demo weex-hackernews代码解读(下)

一份代码处处运行-阿里巴巴Weex

Weex 学习与实践:Weex ,你需要知道的事

Weex开发系列:初识Weex

Weex系列构建Weex工程

浅析weex之vdom渲染