Weex

Weex——自举(Bootstrap)

2017-01-23  本文已影响117人  阿凡提说AI

除了其默认的意义,<script>标签支持在页面的顶级组件中通过 type 属性定义两种配置。

<script type="data">
  /* (可选) 定义初始化数据 */
</script>
 
<script type="config">
  /* (可选) 定义配置项 */
</script>

定义初始化数据

有时,很难在默认的<script>标签中维护巨大的数据结构。所以 Weex 允许我们通过 <script type="data"> 标签定义初始化数据。在这里定义的数据将完全取代默认的 <script> 标签中定义的数据。

例如:

<script type="data">
  module.exports = {
      title: 'Alibaba',
      date: new Date().toLocaleString()
  }
</script>

配置项

Weex 也允许我们通过 <script type="config"> 定义一些配置项,目前,仅只支持配置 downgrade。

downgrade.osVersion
downgrade.appVersion
downgrade.weexVersion
downgrade.deviceModel
上一篇下一篇

猜你喜欢

热点阅读