移动


web-type

<h2>简介</h2> <ul> <li>判断当前域名环境</li> </ul> <h2>引入</h2> <h4>全局引入</h4> <pre><code class="language-javascript">import nat from 'nat'; Vue.use(nat); Vue.$nat.webType.setDefaults(opts) 或 import {webType} from 'nat'; Vue.use(webType, opts);</code></pre> <h4>局部引入</h4> <pre><code class="language-javascript">import { webType } from 'nat'; webType.setDefaults(opts);</code></pre> <h2>初始化属性</h2> <table> <thead> <tr> <th>名称</th> <th>说明</th> <th>类型</th> <th>默认值</th> </tr> </thead> <tbody> <tr> <td>setDefaults</td> <td>设置初始化环境配置</td> <td>Object</td> <td>参考【默认环境类型数据】</td> </tr> </tbody> </table> <h2>方法</h2> <table> <thead> <tr> <th>名称</th> <th>说明</th> <th>类型</th> <th>返回值</th> </tr> </thead> <tbody> <tr> <td>getVersions</td> <td>获取当前环境类型</td> <td>Function</td> <td>String</td> </tr> <tr> <td>getData</td> <td>获取当前环境数据</td> <td>Function</td> <td>String</td> </tr> </tbody> </table> <h2>示例</h2> <h4>全局引入说明</h4> <pre><code>import nat from 'nat'; Vue.use(nat); const list = { isLocal: { type: 'com:1506', data: { home: 'http://testhome.uc158.com' } }, is1505: { type: 'org:1505', data: {} }, is1506: { type: 'org:1506', data: {} }, is1507: { type: 'org:1507', data: {} }, isPre: { type: 'com:2505', data: {} }, isRelease: { type: 'com', data: {} } }; this.$nat.webType.setDefaults(list); this.$nat.webType.getData(); this.$nat.webType.getVersions() ; </code></pre> <h4>局部引入说明</h4> <pre><code>import {webType} from 'nat'; const list = { isLocal: { type: 'com:1506', data: { home: 'http://testhome.uc158.com' } }, is1505: { type: 'org:1505', data: {} }, is1506: { type: 'org:1506', data: {} }, is1507: { type: 'org:1507', data: {} }, isPre: { type: 'com:2505', data: {} }, isRelease: { type: 'com', data: {} } }; webType.setDefaults(list); webType.getData(); webType.getVersions() ; </code></pre> <h2>修订记录</h2> <table> <thead> <tr> <th style="text-align: left;">版本</th> <th style="text-align: left;">日期</th> <th style="text-align: left;">操作内容</th> <th style="text-align: left;">说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">1.0.0</td> <td style="text-align: left;">20181105</td> <td style="text-align: left;">-</td> <td style="text-align: left;">初始版本</td> </tr> </tbody> </table> <h2>备注</h2> <h3>默认环境类型数据</h3> <pre><code class="language-javascript"> const list = { isLocal: { //环境类型 本地开发环境 type: 'com:1506', // 区分环境标记 data: { // 环境数据 URL地址或者域名地址 home: 'http://testhome.uc158.com' } }, is1505: { //环境类型 1505测试环境 type: 'org:1505', data: {} }, is1506: {//环境类型 1506测试环境 type: 'org:1506', data: {} }, is1507: {//环境类型 1507测试环境 type: 'org:1507', data: {} }, isPre: {//环境类型 预发环境 type: 'com:2505', data: {} }, isRelease: {//环境类型 生产环境 type: 'com', data: {} } };</code></pre>

页面列表

ITEM_HTML