Merge pull request #107 from chenjiahan/dev

Doc: improve site load speed
This commit is contained in:
neverland
2017-09-04 15:15:11 +08:00
committed by GitHub
34 changed files with 237 additions and 421 deletions
+4 -4
View File
@@ -73,8 +73,9 @@ Vue.component(Actionsheet.name, Actionsheet);
<van-button @click="show1 = true">弹出actionsheet</van-button>
<van-actionsheet v-model="show1" :actions="actions1">
</van-actionsheet>
```
<script>
```javascript
export default {
data() {
return {
@@ -109,7 +110,6 @@ export default {
}
}
}
</script>
```
:::
@@ -122,8 +122,9 @@ export default {
<van-button @click="show2 = true">弹出带取消按钮的actionsheet</van-button>
<van-actionsheet v-model="show2" :actions="actions1" cancel-text="取消">
</van-actionsheet>
```
<script>
```javascript
export default {
data() {
return {
@@ -152,7 +153,6 @@ export default {
};
}
}
</script>
```
:::
+12 -12
View File
@@ -52,16 +52,16 @@ Vue.component(Checkbox.name, Checkbox);
<div class="van-checkbox-wrapper">
<van-checkbox v-model="checkbox1">复选框1</van-checkbox>
</div>
```
<script>
```javascript
export default {
data() {
return {
checkbox1: true
};
}
};
</script>
};
```
:::
@@ -74,16 +74,16 @@ export default {
<div class="van-checkbox-wrapper">
<van-checkbox v-model="checkbox2" disabled>复选框2</van-checkbox>
</div>
```
<script>
```javascript
export default {
data() {
return {
checkbox2: true
};
}
};
</script>
};
```
:::
@@ -98,8 +98,9 @@ export default {
<van-checkbox v-for="(item, index) in list" :key="index" :name="item">复选框{{item}}</van-checkbox>
</van-checkbox-group>
</div>
```
<script>
```javascript
export default {
data() {
return {
@@ -118,7 +119,6 @@ export default {
}
}
};
</script>
```
:::
@@ -133,8 +133,9 @@ export default {
<van-checkbox v-for="(item, index) in list" :key="index" :name="item">复选框{{item}}</van-checkbox>
</van-checkbox-group>
</div>
```
<script>
```javascript
export default {
data() {
return {
@@ -147,7 +148,6 @@ export default {
};
}
};
</script>
```
:::
@@ -164,8 +164,9 @@ export default {
</van-cell>
</van-cell-group>
</van-checkbox-group>
```
<script>
```javascript
export default {
data() {
return {
@@ -178,7 +179,6 @@ export default {
};
}
};
</script>
```
:::
+2 -2
View File
@@ -50,8 +50,9 @@ Vue.component(DatetimePicker.name, DatetimePicker);
:max-date="maxDate"
@change="handlePickerChange">
</van-datetime-picker>
```
<script>
```javascript
export default {
data() {
return {
@@ -69,7 +70,6 @@ export default {
}
}
};
</script>
```
:::
-1
View File
@@ -119,7 +119,6 @@ export default {
}
}
}
</script>
```
:::
+5 -5
View File
@@ -7,7 +7,7 @@
</style>
<script>
import { Dialog } from 'packages/index';
import { Dialog } from 'packages';
const message = '弹窗内容';
@@ -56,8 +56,9 @@ import { Dialog } from 'vant';
```html
<van-button @click="onClickAlert">Alert</van-button>
<van-button @click="onClickAlert2">无标题 Alert</van-button>
```
<script>
```javascript
export default {
methods: {
onClickAlert() {
@@ -78,7 +79,6 @@ export default {
}
}
};
</script>
```
:::
@@ -89,8 +89,9 @@ export default {
:::demo 消息确认
```html
<van-button @click="onClickConfirm">Confirm</van-button>
```
<script>
```javascript
export default {
methods: {
onClickConfirm() {
@@ -105,7 +106,6 @@ export default {
}
}
};
</script>
```
:::
+11 -17
View File
@@ -1,7 +1,7 @@
## ExpressWay 配送方式
<script>
import { Toast, CellGroup } from 'packages/index';
import { Toast } from 'packages';
export default {
data() {
@@ -26,10 +26,6 @@ export default {
onChange(item, index) {
Toast('配送方式更换为:' + item.postage_title);
}
},
components: {
[CellGroup.name]: CellGroup
}
}
</script>
@@ -47,17 +43,16 @@ Vue.component(ExpressWay.name, ExpressWay);
:::demo 基础用法
```html
<template>
<van-cell-group>
<van-express-way
v-model="currentExpressType"
:express-list="expressList"
@change="onChange"
/>
</van-cell-group>
</tempalte>
<van-cell-group>
<van-express-way
v-model="currentExpressType"
:express-list="expressList"
@change="onChange"
></van-express-way>
</van-cell-group>
```
<script>
```javascript
export default {
data() {
return {
@@ -77,7 +72,6 @@ export default {
}
}
}
</script>
```
:::
@@ -91,7 +85,7 @@ export default {
:express-list="expressList"
:editable="false"
@change="onChange"
/>
></van-express-way>
</van-cell-group>
```
:::
-5
View File
@@ -32,7 +32,6 @@
<script>
import Vue from 'vue';
import { Icon, Col } from 'packages';
const icons = [
'close',
@@ -113,10 +112,6 @@ const icons = [
];
const IconListConstructor = Vue.extend({
components: {
[Col.name]: Col,
[Icon.name]: Icon
},
render(h) {
return (
<div>
+1 -1
View File
@@ -7,7 +7,7 @@
</style>
<script>
import { ImagePreview } from 'packages/index';
import { ImagePreview } from 'packages';
export default {
methods: {
+3 -5
View File
@@ -33,11 +33,10 @@ Vue.component(InvalidGoods.name, InvalidGoods);
:::demo 基础用法
```html
<template>
<van-invalid-goods :goods="goods" />
<tempalte/>
<van-invalid-goods :goods="goods" />
```
<script>
```javascript
const item = {
num: 2,
sku_id: 123,
@@ -58,7 +57,6 @@ export default {
}
}
}
</script>
```
:::
+6 -6
View File
@@ -71,8 +71,9 @@ Vue.use(Lazyload, options);
<img class="lazy-img" v-lazy="img">
</li>
</ul>
```
<script>
```javascript
export default {
data() {
return {
@@ -87,7 +88,6 @@ export default {
};
}
}
</script>
```
:::
@@ -102,8 +102,9 @@ export default {
<div class="lazy-background" v-lazy:background-image="img"></div>
</li>
</ul>
```
<script>
```javascript
export default {
data() {
return {
@@ -114,7 +115,6 @@ export default {
};
}
}
</script>
```
:::
@@ -131,8 +131,9 @@ export default {
</li>
</ul>
</lazy-component>
```
<script>
```javascript
export default {
data() {
return {
@@ -149,7 +150,6 @@ export default {
}
}
}
</script>
```
:::
+24 -31
View File
@@ -64,16 +64,15 @@ Vue.component(OrderGoods.name, OrderGoods);
:::demo 基础用法
```html
<template>
<van-order-goods
v-model="message1"
shop-name="起码运动馆"
:price="1050"
:item-list="itemList1"
/>
</template>
<van-order-goods
v-model="message1"
shop-name="起码运动馆"
:price="1050"
:item-list="itemList1"
/>
```
<script>
```javascript
export default {
data() {
return {
@@ -87,7 +86,6 @@ export default {
}
}
}
</script>
```
:::
@@ -95,17 +93,16 @@ export default {
:::demo 积分商品
```html
<template>
<van-order-goods
v-model="message2"
shop-name="起码运动馆"
:item-list="itemList2"
:price="50"
:points="200"
/>
</template>
<van-order-goods
v-model="message2"
shop-name="起码运动馆"
:item-list="itemList2"
:price="50"
:points="200"
/>
```
<script>
```javascript
export default {
data() {
return {
@@ -124,7 +121,6 @@ export default {
}
}
}
</script>
```
:::
@@ -132,16 +128,14 @@ export default {
:::demo 预售商品
```html
<template>
<van-order-goods
v-model="message3"
shop-name="起码运动馆"
:price="1050"
:item-list="itemList3"
/>
</template>
<van-order-goods
v-model="message3"
shop-name="起码运动馆"
:price="1050"
:item-list="itemList3"
/>
<script>
```javascript
export default {
data() {
return {
@@ -159,7 +153,6 @@ export default {
}
}
}
</script>
```
:::
+1 -1
View File
@@ -1,7 +1,7 @@
## PayOrder 支付订单
<script>
import { Toast } from 'packages/index';
import { Toast } from 'packages';
export default {
methods: {
+4 -4
View File
@@ -52,8 +52,9 @@ Vue.component(Picker.name, Picker);
:::demo 基础用法
```html
<van-picker :columns="pickerColumns" @change="handlePickerChange"></van-picker>
```
<script>
```javascript
const citys = {
'浙江': ['杭州', '宁波', '温州', '嘉兴', '湖州', '绍兴', '金华', '衢州', '舟山', '台州', '丽水'],
'福建': ['福州', '厦门', '莆田', '三明', '泉州', '漳州', '南平', '龙岩', '宁德'],
@@ -82,7 +83,6 @@ export default {
}
}
};
</script>
```
:::
@@ -98,8 +98,9 @@ export default {
@cancel="handlePickerCancel"
@confirm="handlePickerConfirm"
></van-picker>
```
<script>
```javascript
const citys = {
'浙江': ['杭州', '宁波', '温州', '嘉兴', '湖州', '绍兴', '金华', '衢州', '舟山', '台州', '丽水'],
'福建': ['福州', '厦门', '莆田', '三明', '泉州', '漳州', '南平', '龙岩', '宁德'],
@@ -135,7 +136,6 @@ export default {
}
}
};
</script>
```
:::
+4 -4
View File
@@ -94,8 +94,9 @@ Vue.component(Popup.name, Popup);
<van-popup v-model="popupShow1" class="van-popup-1" :lock-on-scroll="true">
从中间弹出popup
</van-popup>
```
<script>
```javascript
export default {
data() {
return {
@@ -103,7 +104,6 @@ export default {
}
}
};
</script>
```
:::
@@ -133,8 +133,9 @@ export default {
<van-popup v-model="popupShow5" position="left" class="van-popup-5" :overlay="false">
<van-button @click.native="popupShow5 = false">关闭 popup</van-button>
</van-popup>
```
<script>
```javascript
export default {
data() {
return {
@@ -155,7 +156,6 @@ export default {
}
}
};
</script>
```
:::
+8 -9
View File
@@ -44,8 +44,8 @@ Vue.component(Radio.name, Radio);
<van-radio name="1" v-model="radio1">单选框1</van-radio>
<van-radio name="2" v-model="radio1">单选框2</van-radio>
</div>
<script>
```
```javascript
export default {
data() {
return {
@@ -53,7 +53,6 @@ export default {
}
}
};
</script>
```
:::
@@ -67,8 +66,9 @@ export default {
<van-radio name="1" v-model="radio2" disabled>未选中禁用</van-radio>
<van-radio name="2" v-model="radio2" disabled>选中且禁用</van-radio>
</div>
```
<script>
```javascript
export default {
data() {
return {
@@ -76,7 +76,6 @@ export default {
}
}
};
</script>
```
:::
@@ -92,8 +91,9 @@ export default {
<van-radio name="2">单选框2</van-radio>
</van-radio-group>
</div>
```
<script>
```javascript
export default {
data() {
return {
@@ -101,7 +101,6 @@ export default {
}
}
};
</script>
```
:::
@@ -117,8 +116,9 @@ export default {
<van-cell><van-radio name="2">单选框2</van-radio></van-cell>
</van-cell-group>
</van-radio-group>
```
<script>
```javascript
export default {
data() {
return {
@@ -126,7 +126,6 @@ export default {
}
}
};
</script>
```
:::
+4 -4
View File
@@ -32,8 +32,9 @@ Vue.component(Search.name, Search);
:::demo 基础用法
```html
<van-search placeholder="商品名称" @search="goSearch"></van-search>
```
<script>
```javascript
export default {
methods: {
goSearch(value) {
@@ -41,7 +42,6 @@ export default {
}
}
};
</script>
```
:::
@@ -60,8 +60,9 @@ export default {
:::demo 监听对应事件
```html
<van-search placeholder="商品名称" @search="goSearch" @change="handleChange" @cancel="handleCancel"></van-search>
```
<script>
```javascript
export default {
methods: {
goSearch(value) {
@@ -75,7 +76,6 @@ export default {
}
}
};
</script>
```
:::
+2 -2
View File
@@ -55,8 +55,9 @@ Vue.component(Steps.name, Steps);
</van-steps>
<van-button @click="nextStep">下一步</van-button>
```
<script>
```javascript
export default {
data() {
return {
@@ -70,7 +71,6 @@ export default {
}
}
}
</script>
```
:::
+6 -6
View File
@@ -55,8 +55,9 @@ Vue.component(Swipe.name, Swipe);
</a>
</van-swipe-item>
</van-swipe>
```
<script>
```javascript
export default {
data() {
return {
@@ -67,7 +68,6 @@ export default {
};
}
};
</script>
```
:::
@@ -82,8 +82,9 @@ export default {
<img v-lazy="img" alt="">
</van-swipe-item>
</van-swipe>
```
<script>
```javascript
export default {
data() {
return {
@@ -94,7 +95,6 @@ export default {
};
}
};
</script>
```
:::
@@ -109,8 +109,9 @@ export default {
<img v-lazy="img" alt="">
</van-swipe-item>
</van-swipe>
```
<script>
```javascript
export default {
data() {
return {
@@ -127,7 +128,6 @@ export default {
}
}
};
</script>
```
:::
+5 -7
View File
@@ -25,13 +25,12 @@ Vue.component(SwitchCell.name, SwitchCell);
:::demo 基础用法
```html
<template>
<van-cell-group>
<van-switch-cell v-model="checked" title="标题" />
</van-cell-group>
</template>
<van-cell-group>
<van-switch-cell v-model="checked" title="标题" />
</van-cell-group>
```
<script>
```javascript
export default {
data() {
return {
@@ -39,7 +38,6 @@ export default {
}
}
}
</script>
```
:::
+6 -8
View File
@@ -66,10 +66,9 @@ Vue.component(Switch.name, Switch);
<div class="demo-switch__text">{{ switchState2 ? ' 打开' : '关闭' }}</div>
</van-col>
</van-row>
```
<script>
```javascript
export default {
data() {
return {
@@ -90,7 +89,6 @@ export default {
}
}
};
</script>
```
:::
@@ -110,8 +108,9 @@ export default {
<div class="demo-switch__text">关闭</div>
</van-col>
</van-row>
```
<script>
```javascript
export default {
data() {
return {
@@ -120,7 +119,6 @@ export default {
};
}
};
</script>
```
:::
@@ -140,8 +138,9 @@ export default {
<div class="demo-switch__text">关闭</div>
</van-col>
</van-row>
```
<script>
```javascript
export default {
data() {
return {
@@ -150,7 +149,6 @@ export default {
};
}
};
</script>
```
:::
+4 -4
View File
@@ -134,8 +134,9 @@ Vue.component(Tabs.name, Tabs);
<van-tab title="选项三">内容三</van-tab>
<van-tab title="选项四">内容四</van-tab>
</van-tabs>
```
<script>
```javascript
export default {
methods: {
popalert() {
@@ -143,7 +144,6 @@ export default {
}
}
};
</script>
```
:::
@@ -216,8 +216,9 @@ export default {
<van-tab title="选项三">内容三</van-tab>
<van-tab title="选项四">内容四</van-tab>
</van-tabs>
```
<script>
```javascript
export default {
methods: {
handleTabClick(index) {
@@ -225,7 +226,6 @@ export default {
}
}
};
</script>
```
:::
+10 -10
View File
@@ -7,7 +7,7 @@
</style>
<script>
import { Toast } from 'packages/index';
import { Toast } from 'packages';
export default {
methods: {
@@ -83,9 +83,10 @@ import { Toast } from 'vant';
<van-button @click="showFailToast">失败</van-button>
<van-button @click="showForbidClickToast">背景不能点击</van-button>
<van-button @click="showCustomizedToast(5000)">倒数5秒</van-button>
```
<script>
import { Toast } from 'packages/index';
```javascript
import { Toast } from 'packages';
export default {
methods: {
@@ -125,7 +126,6 @@ export default {
}
}
};
</script>
```
:::
@@ -135,9 +135,10 @@ export default {
```html
<van-button @click="showToast">打开</van-button>
<van-button @click="closeToast">关闭</van-button>
```
<script>
import { Toast } from 'packages/index';
```javascript
import { Toast } from 'packages';
export default {
methods: {
@@ -149,7 +150,6 @@ export default {
}
}
};
</script>
```
:::
@@ -159,9 +159,10 @@ export default {
:::demo 手动关闭
```html
<van-button @click="showHtmlToast">打开</van-button>
```
<script>
import { Toast } from 'packages/index';
```javascript
import { Toast } from 'packages';
export default {
methods: {
@@ -173,7 +174,6 @@ export default {
}
}
};
</script>
```
:::
+2 -2
View File
@@ -34,8 +34,9 @@ Vue.component(Uploader.name, Uploader);
<van-icon name="photograph"></van-icon>
</van-uploader>
</div>
```
<script>
```javascript
export default {
methods: {
logContent(file) {
@@ -43,7 +44,6 @@ export default {
}
}
};
</script>
```
:::
+6 -4
View File
@@ -1,6 +1,6 @@
<template>
<div class="app">
<zan-doc :simulator="simulatorSrc" :config="config">
<zan-doc :simulator="simulator" :config="config">
<router-view></router-view>
</zan-doc>
</div>
@@ -12,12 +12,14 @@ import docConfig from './doc.config';
export default {
data() {
return {
simulator: this.getSimulatorPath(),
config: docConfig['zh-CN']
};
},
computed: {
simulatorSrc() {
const dir = this.$route.path.split('/').pop();
methods: {
getSimulatorPath() {
const dir = location.pathname.split('/').pop();
if (dir === 'quickstart' || dir === 'changelog') {
return '/zanui/vue/examples';
} else {
-17
View File
@@ -1,17 +0,0 @@
<template>
<zan-doc-block :class="`demo-${component}`">
<slot name="highlight"></slot>
</zan-doc-block>
</template>
<script>
export default {
name: 'demo-block',
computed: {
component() {
return this.$route.path.split('/').pop();
}
}
};
</script>
+7 -1
View File
@@ -18,7 +18,7 @@ Vue.use(VueRouter);
const routesConfig = routes(true);
routesConfig.push({
path: '/',
component: DemoList.default || DemoList
component: DemoList
});
const router = new VueRouter({
mode: 'history',
@@ -33,6 +33,12 @@ router.beforeEach((to, from, next) => {
next();
});
router.afterEach(() => {
window.syncPath();
});
window.vueRouter = router;
new Vue({ // eslint-disable-line
render: h => h(App),
router
+36
View File
@@ -0,0 +1,36 @@
/**
* 同步父窗口和 iframe 的 vue-router 状态
*/
import isMobile from './is-mobile';
window.syncPath = function(dir) {
const router = window.vueRouter;
const isInIframe = window !== window.top;
const currentDir = router.history.current.path;
const iframe = document.querySelector('iframe');
if (!isInIframe && !isMobile && iframe) {
iframeReady(iframe, () => {
iframe.contentWindow.changePath(currentDir);
});
}
};
window.changePath = function(path) {
const router = window.vueRouter;
router.replace(path);
};
function iframeReady(iframe, callback) {
const doc = iframe.contentDocument || iframe.contentWindow.document;
if (doc.readyState === 'complete') {
callback();
} else {
iframe.onload = () => {
setTimeout(() => {
callback();
}, 50);
};
}
}
+4 -9
View File
@@ -3,17 +3,10 @@ import VueRouter from 'vue-router';
import App from './ExamplesDocsApp';
import routes from './router.config';
import ZanDoc from 'zan-doc';
import DemoBlock from './components/demo-block';
const isMobile = (function() {
var platform = navigator.userAgent.toLowerCase();
return (/(android|bb\d+|meego).+mobile|kdtunion|weibo|m2oapp|micromessenger|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i).test(platform) ||
(/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i).test(platform.substr(0, 4));
})();
import isMobile from './is-mobile';
Vue.use(VueRouter);
Vue.use(ZanDoc);
Vue.component(DemoBlock.name, DemoBlock);
const routesConfig = routes();
routesConfig.push({
@@ -30,7 +23,6 @@ const router = new VueRouter({
router.beforeEach((route, redirect, next) => {
if (isMobile) {
window.location.replace('/zanui/vue/examples');
return;
}
document.title = route.meta.title || document.title;
next();
@@ -40,8 +32,11 @@ router.afterEach(() => {
if (!isMobile) {
window.scrollTo(0, 0);
}
window.syncPath();
});
window.vueRouter = router;
new Vue({ // eslint-disable-line
render: h => h(App),
router
+7
View File
@@ -0,0 +1,7 @@
const isMobile = (function() {
var platform = navigator.userAgent.toLowerCase();
return (/(android|bb\d+|meego).+mobile|kdtunion|weibo|m2oapp|micromessenger|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i).test(platform) ||
(/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i).test(platform.substr(0, 4));
})();
export default isMobile;
+9 -2
View File
@@ -1,9 +1,16 @@
const navs = require('./doc.config')['zh-CN'].nav;
import docConfig from './doc.config';
import componentDocs from '../examples-dist/entry-docs';
import componentDemos from '../examples-dist/entry-demos';
import './iframe-router';
const navs = docConfig['zh-CN'].nav;
const registerRoute = (isExample) => {
let route = [];
const route = [{
path: '*',
redirect: '/'
}];
navs.forEach(nav => {
if (isExample && !nav.showInMobile) {
return;