docs: should hide some demes in vant-weapp

This commit is contained in:
陈嘉涵 2019-12-30 11:37:07 +08:00
parent 11faabd408
commit 630155833f
11 changed files with 19 additions and 11 deletions

View File

@ -13,6 +13,9 @@ Locale.add({
'en-US': enUS
});
// flag for vant-weapp demos
const isWeapp = location.search.indexOf('weapp=1') !== -1;
// helper for demo locales
Vue.mixin({
computed: {
@ -26,6 +29,10 @@ Vue.mixin({
const message = get(messages, prefix + path) || get(messages, path);
return typeof message === 'function' ? message(...args) : message;
};
},
isWeapp() {
return isWeapp;
}
},
@ -45,6 +52,7 @@ Vue.mixin({
}
});
// switch lang after routing
if (window.vueRouter) {
window.vueRouter.afterEach(to => {
const { lang } = to.meta || {};

View File

@ -16,7 +16,7 @@
<van-cell :title="$t('cell')" :value="$t('content')" icon="location-o" />
</demo-block>
<demo-block v-if="!$attrs.weapp" :title="$t('valueOnly')">
<demo-block v-if="!isWeapp" :title="$t('valueOnly')">
<van-cell :value="$t('content')" />
</demo-block>

View File

@ -62,7 +62,7 @@
</van-checkbox-group>
</demo-block>
<demo-block v-if="!$attrs.weapp" :title="$t('toggleAll')">
<demo-block v-if="!isWeapp" :title="$t('toggleAll')">
<van-checkbox-group v-model="checkAllResult" ref="group">
<van-checkbox name="a">{{ $t('checkbox') }} a</van-checkbox>
<van-checkbox name="b">{{ $t('checkbox') }} b</van-checkbox>

View File

@ -36,7 +36,7 @@
</demo-block>
<demo-block
v-if="!$attrs.weapp"
v-if="!isWeapp"
:title="$t('title3')"
>
<van-row type="flex">

View File

@ -87,7 +87,7 @@
</van-cell-group>
</demo-block>
<demo-block v-if="!$attrs.weapp" :title="$t('showWordLimit')">
<demo-block v-if="!isWeapp" :title="$t('showWordLimit')">
<van-cell-group>
<van-field
v-model="message2"

View File

@ -44,7 +44,7 @@
<van-popup v-model="showRoundCorner" round position="bottom" :style="{ height: '20%' }" />
</demo-block>
<demo-block v-if="!$attrs.weapp" :title="$t('getContainer')">
<demo-block v-if="!isWeapp" :title="$t('getContainer')">
<van-cell :title="$t('getContainer')" is-link @click="showGetContainer = true" />
<van-popup v-model="showGetContainer" get-container="body" :style="{ padding: '30px 50px' }" />
</demo-block>

View File

@ -4,7 +4,7 @@
<van-progress :percentage="50" />
</demo-block>
<demo-block v-if="!$attrs.weapp" :title="$t('strokeWidth')">
<demo-block v-if="!isWeapp" :title="$t('strokeWidth')">
<van-progress :percentage="50" stroke-width="8" />
</demo-block>

View File

@ -51,7 +51,7 @@
</van-slider>
</demo-block>
<demo-block v-if="!$attrs.weapp" :title="$t('vertical')">
<demo-block v-if="!isWeapp" :title="$t('vertical')">
<div :style="{ height: '120px', paddingLeft: '30px' }">
<van-slider
v-model="value7"

View File

@ -12,7 +12,7 @@
</van-sticky>
</demo-block>
<demo-block v-if="!$attrs.weapp" :title="$t('setContainer')">
<demo-block v-if="!isWeapp" :title="$t('setContainer')">
<div ref="container" style="height: 150px; background-color: #fff;">
<van-sticky :container="container">
<van-button type="warning" style="margin-left: 215px;">{{ $t('setContainer') }}</van-button>

View File

@ -67,7 +67,7 @@
</van-tabs>
</demo-block>
<demo-block v-if="!$attrs.weapp" :title="$t('title7')">
<demo-block v-if="!isWeapp" :title="$t('title7')">
<van-tabs :active="active">
<van-tab v-for="index in 2" :key="index">
<template #title>
@ -94,7 +94,7 @@
</van-tabs>
</demo-block>
<demo-block v-if="!$attrs.weapp" :title="$t('title10')">
<demo-block v-if="!isWeapp" :title="$t('title10')">
<van-tabs scrollspy sticky>
<van-tab :title="$t('tab') + index" v-for="index in 10" :key="index">
{{ $t('content') }} {{ index }}

View File

@ -15,7 +15,7 @@
<van-button type="danger" :text="$t('fail')" @click="showFailToast" />
</demo-block>
<demo-block v-if="!$attrs.weapp" :title="$t('customIcon')">
<demo-block v-if="!isWeapp" :title="$t('customIcon')">
<van-button type="primary" :text="$t('customIcon')" @click="showIconToast" />
<van-button type="primary" :text="$t('customImage')" @click="showImageToast" />
</demo-block>