[improvement] update eslint rules (#2089)

This commit is contained in:
neverland 2018-11-15 15:30:17 +08:00 committed by GitHub
parent 0860901ec1
commit e14b43e66a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
129 changed files with 1874 additions and 456 deletions

View File

@ -3,21 +3,19 @@
"env": { "env": {
"jest": true "jest": true
}, },
"extends": ["plugin:vue-libs/recommended", "plugin:vue/strongly-recommended"], "extends": ["plugin:vue-libs/recommended", "plugin:vue/recommended"],
"rules": { "rules": {
"semi": ["error", "always"], "semi": ["error", "always"],
"space-before-function-paren": ["error", "never"], "space-before-function-paren": ["error", "never"],
"vue/attributes-order": 0,
"vue/require-v-for-key": 0, "vue/require-v-for-key": 0,
"vue/require-default-prop": 0, "vue/require-default-prop": 0,
"vue/name-property-casing": 0, "vue/name-property-casing": ["error", "kebab-case"],
"vue/max-attributes-per-line": [ "vue/html-closing-bracket-newline": [
2, "error",
{ {
"singleline": 5, "singleline": "never",
"multiline": { "multiline": "always"
"max": 5,
"allowFirstLine": false
}
} }
] ]
} }

View File

@ -80,7 +80,7 @@
"cross-env": "^5.2.0", "cross-env": "^5.2.0",
"css-loader": "^1.0.1", "css-loader": "^1.0.1",
"dependency-tree": "^6.2.1", "dependency-tree": "^6.2.1",
"eslint": "^5.8.0", "eslint": "^5.9.0",
"eslint-plugin-vue-libs": "^3.0.0", "eslint-plugin-vue-libs": "^3.0.0",
"fast-glob": "^2.2.3", "fast-glob": "^2.2.3",
"fast-vue-md-loader": "^1.0.3", "fast-vue-md-loader": "^1.0.3",

View File

@ -2,7 +2,11 @@
<demo-section> <demo-section>
<demo-block :title="$t('basicUsage')"> <demo-block :title="$t('basicUsage')">
<van-button @click="show1 = true">{{ $t('button1') }}</van-button> <van-button @click="show1 = true">{{ $t('button1') }}</van-button>
<van-actionsheet v-model="show1" :actions="actions" @select="onSelect" /> <van-actionsheet
v-model="show1"
:actions="actions"
@select="onSelect"
/>
</demo-block> </demo-block>
<demo-block :title="$t('title2')"> <demo-block :title="$t('title2')">
@ -18,7 +22,10 @@
<demo-block :title="$t('title3')"> <demo-block :title="$t('title3')">
<van-button @click="show3 = true">{{ $t('button3') }}</van-button> <van-button @click="show3 = true">{{ $t('button3') }}</van-button>
<van-actionsheet v-model="show3" :title="$t('title')"> <van-actionsheet
v-model="show3"
:title="$t('title')"
>
<p>{{ $t('content') }}</p> <p>{{ $t('content') }}</p>
</van-actionsheet> </van-actionsheet>
</demo-block> </demo-block>

View File

@ -1,11 +1,25 @@
<template> <template>
<transition name="van-slide-bottom"> <transition name="van-slide-bottom">
<div v-if="shouldRender" v-show="value" :class="b({ 'withtitle': title })"> <div
<div v-if="title" class="van-hairline--top-bottom" :class="b('header')"> v-if="shouldRender"
v-show="value"
:class="b({ 'withtitle': title })"
>
<div
v-if="title"
:class="b('header')"
class="van-hairline--top-bottom"
>
<div v-text="title" /> <div v-text="title" />
<icon name="close" @click="onCancel" /> <icon
name="close"
@click="onCancel"
/>
</div> </div>
<ul v-else class="van-hairline--bottom"> <ul
v-else
class="van-hairline--bottom"
>
<li <li
v-for="item in actions" v-for="item in actions"
:class="[b('item', { disabled: item.disabled || item.loading }), item.className, 'van-hairline--top']" :class="[b('item', { disabled: item.disabled || item.loading }), item.className, 'van-hairline--top']"
@ -13,9 +27,18 @@
> >
<template v-if="!item.loading"> <template v-if="!item.loading">
<span :class="b('name')">{{ item.name }}</span> <span :class="b('name')">{{ item.name }}</span>
<span :class="b('subname')" v-if="item.subname">{{ item.subname }}</span> <span
v-if="item.subname"
:class="b('subname')"
>
{{ item.subname }}
</span>
</template> </template>
<loading v-else :class="b('loading')" size="20px" /> <loading
v-else
:class="b('loading')"
size="20px"
/>
</li> </li>
</ul> </ul>
<div <div
@ -24,7 +47,10 @@
:class="[b('cancel'), 'van-hairline--top']" :class="[b('cancel'), 'van-hairline--top']"
@click="onCancel" @click="onCancel"
/> />
<div v-else :class="b('content')"> <div
v-else
:class="b('content')"
>
<slot /> <slot />
</div> </div>
</div> </div>

View File

@ -23,8 +23,7 @@
</span> </span>
</field> </field>
<cell <cell
v-if="showSearchList" v-for="express in searchList"
v-for="express in searchResult"
:key="express.name + express.address" :key="express.name + express.address"
:title="express.name" :title="express.name"
:label="express.address" :label="express.address"
@ -61,8 +60,11 @@ export default create({
}, },
computed: { computed: {
showSearchList() { searchList() {
return this.showSearchResult && this.focused && this.searchResult.length; if (this.showSearchResult && this.focused) {
return this.searchResult || [];
};
return [];
}, },
showIcon() { showIcon() {

View File

@ -58,16 +58,34 @@
@change="$emit('change-default', $event)" @change="$emit('change-default', $event)"
/> />
<div v-show="!hideBottomFields" :class="b('buttons')"> <div
<van-button block :loading="isSaving" @click="onSave" type="danger"> v-show="!hideBottomFields"
:class="b('buttons')"
>
<van-button
block
:loading="isSaving"
type="danger"
@click="onSave"
>
{{ saveButtonText || $t('save') }} {{ saveButtonText || $t('save') }}
</van-button> </van-button>
<van-button block :loading="isDeleting" @click="onDelete" v-if="showDelete"> <van-button
v-if="showDelete"
block
:loading="isDeleting"
@click="onDelete"
>
{{ deleteButtonText || $t('delete') }} {{ deleteButtonText || $t('delete') }}
</van-button> </van-button>
</div> </div>
<popup v-model="showAreaPopup" position="bottom" :lazy-render="false" get-container="body"> <popup
v-model="showAreaPopup"
position="bottom"
:lazy-render="false"
get-container="body"
>
<van-area <van-area
ref="area" ref="area"
:loading="!areaListLoaded" :loading="!areaListLoaded"

View File

@ -116,9 +116,13 @@ exports[`renders demo correctly 1`] = `
<div name="popup-slide-bottom" class="van-popup van-popup--bottom" style="display:none;"> <div name="popup-slide-bottom" class="van-popup van-popup--bottom" style="display:none;">
<div class="van-picker van-area"> <div class="van-picker van-area">
<div class="van-hairline--top-bottom van-picker__toolbar"> <div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">取消</div> <div class="van-picker__cancel">
取消
</div>
<!----> <!---->
<div class="van-picker__confirm">确认</div> <div class="van-picker__confirm">
确认
</div>
</div> </div>
<!----> <!---->
<div class="van-picker__columns" style="height:220px;"> <div class="van-picker__columns" style="height:220px;">

View File

@ -84,9 +84,13 @@ exports[`create a AddressEdit 1`] = `
<div name="popup-slide-bottom" class="van-popup van-popup--bottom" style="display:none;"> <div name="popup-slide-bottom" class="van-popup van-popup--bottom" style="display:none;">
<div class="van-picker van-area"> <div class="van-picker van-area">
<div class="van-hairline--top-bottom van-picker__toolbar"> <div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">取消</div> <div class="van-picker__cancel">
取消
</div>
<!----> <!---->
<div class="van-picker__confirm">确认</div> <div class="van-picker__confirm">
确认
</div>
</div> </div>
<div class="van-picker__loading"> <div class="van-picker__loading">
<div class="van-loading van-loading--circular van-loading" style="color:#c9c9c9;width:undefined;height:undefined;"><span class="van-loading__spinner van-loading__spinner--circular"> <svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span></div> <div class="van-loading van-loading--circular van-loading" style="color:#c9c9c9;width:undefined;height:undefined;"><span class="van-loading__spinner van-loading__spinner--circular"> <svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span></div>
@ -220,9 +224,13 @@ exports[`create a AddressEdit with props 1`] = `
<div name="popup-slide-bottom" class="van-popup van-popup--bottom" style="display:none;"> <div name="popup-slide-bottom" class="van-popup van-popup--bottom" style="display:none;">
<div class="van-picker van-area"> <div class="van-picker van-area">
<div class="van-hairline--top-bottom van-picker__toolbar"> <div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">取消</div> <div class="van-picker__cancel">
取消
</div>
<!----> <!---->
<div class="van-picker__confirm">确认</div> <div class="van-picker__confirm">
确认
</div>
</div> </div>
<!----> <!---->
<div class="van-picker__columns" style="height:220px;"> <div class="van-picker__columns" style="height:220px;">

View File

@ -1,7 +1,10 @@
<template> <template>
<div :class="b()"> <div :class="b()">
<slot name="top" /> <slot name="top" />
<radio-group :value="value" @input="$emit('input', $event)"> <radio-group
:value="value"
@input="$emit('input', $event)"
>
<cell-group> <cell-group>
<address-item <address-item
v-for="(item, index) in list" v-for="(item, index) in list"
@ -13,7 +16,12 @@
/> />
</cell-group> </cell-group>
</radio-group> </radio-group>
<div v-if="disabledText" :class="b('disabled-text')">{{ disabledText }}</div> <div
v-if="disabledText"
:class="b('disabled-text')"
>
{{ disabledText }}
</div>
<cell-group v-if="disabledList.length"> <cell-group v-if="disabledList.length">
<address-item <address-item
v-for="(item, index) in disabledList" v-for="(item, index) in disabledList"

View File

@ -28,7 +28,9 @@ exports[`renders demo correctly 1`] = `
</div> </div>
</div> </div>
</div> </div>
<div class="van-address-list__disabled-text">以下地址超出配送范围</div> <div class="van-address-list__disabled-text">
以下地址超出配送范围
</div>
<div class="van-cell-group van-hairline--top-bottom"> <div class="van-cell-group van-hairline--top-bottom">
<div class="van-cell van-address-item van-address-item--disabled van-address-item--unswitchable"> <div class="van-cell van-address-item van-address-item--disabled van-address-item--unswitchable">
<!----> <!---->

View File

@ -1,15 +1,25 @@
<template> <template>
<demo-section> <demo-section>
<demo-block :title="$t('basicUsage')"> <demo-block :title="$t('basicUsage')">
<van-area ref="area" :area-list="$t('areaList')" /> <van-area
ref="area"
:area-list="$t('areaList')"
/>
</demo-block> </demo-block>
<demo-block :title="$t('title2')"> <demo-block :title="$t('title2')">
<van-area :area-list="$t('areaList')" :value="value" /> <van-area
:area-list="$t('areaList')"
:value="value"
/>
</demo-block> </demo-block>
<demo-block :title="$t('title3')"> <demo-block :title="$t('title3')">
<van-area :area-list="$t('areaList')" :columns-num="2" :title="$t('title')" /> <van-area
:area-list="$t('areaList')"
:columns-num="2"
:title="$t('title')"
/>
</demo-block> </demo-block>
</demo-section> </demo-section>
</template> </template>

View File

@ -5,9 +5,13 @@ exports[`renders demo correctly 1`] = `
<div> <div>
<div class="van-picker van-area"> <div class="van-picker van-area">
<div class="van-hairline--top-bottom van-picker__toolbar"> <div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">取消</div> <div class="van-picker__cancel">
取消
</div>
<!----> <!---->
<div class="van-picker__confirm">确认</div> <div class="van-picker__confirm">
确认
</div>
</div> </div>
<!----> <!---->
<div class="van-picker__columns" style="height:220px;"> <div class="van-picker__columns" style="height:220px;">
@ -27,9 +31,13 @@ exports[`renders demo correctly 1`] = `
<div> <div>
<div class="van-picker van-area"> <div class="van-picker van-area">
<div class="van-hairline--top-bottom van-picker__toolbar"> <div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">取消</div> <div class="van-picker__cancel">
取消
</div>
<!----> <!---->
<div class="van-picker__confirm">确认</div> <div class="van-picker__confirm">
确认
</div>
</div> </div>
<!----> <!---->
<div class="van-picker__columns" style="height:220px;"> <div class="van-picker__columns" style="height:220px;">
@ -49,9 +57,13 @@ exports[`renders demo correctly 1`] = `
<div> <div>
<div class="van-picker van-area"> <div class="van-picker van-area">
<div class="van-hairline--top-bottom van-picker__toolbar"> <div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">取消</div> <div class="van-picker__cancel">
取消
</div>
<div class="van-ellipsis van-picker__title">标题</div> <div class="van-ellipsis van-picker__title">标题</div>
<div class="van-picker__confirm">确认</div> <div class="van-picker__confirm">
确认
</div>
</div> </div>
<!----> <!---->
<div class="van-picker__columns" style="height:220px;"> <div class="van-picker__columns" style="height:220px;">

View File

@ -3,9 +3,13 @@
exports[`change option 1`] = ` exports[`change option 1`] = `
<div class="van-picker van-area"> <div class="van-picker van-area">
<div class="van-hairline--top-bottom van-picker__toolbar"> <div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">取消</div> <div class="van-picker__cancel">
取消
</div>
<!----> <!---->
<div class="van-picker__confirm">确认</div> <div class="van-picker__confirm">
确认
</div>
</div> </div>
<!----> <!---->
<div class="van-picker__columns" style="height: 220px;"> <div class="van-picker__columns" style="height: 220px;">
@ -26,9 +30,13 @@ exports[`change option 1`] = `
exports[`change option 2`] = ` exports[`change option 2`] = `
<div class="van-picker van-area"> <div class="van-picker van-area">
<div class="van-hairline--top-bottom van-picker__toolbar"> <div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">取消</div> <div class="van-picker__cancel">
取消
</div>
<!----> <!---->
<div class="van-picker__confirm">确认</div> <div class="van-picker__confirm">
确认
</div>
</div> </div>
<!----> <!---->
<div class="van-picker__columns" style="height: 220px;"> <div class="van-picker__columns" style="height: 220px;">
@ -58,9 +66,13 @@ exports[`change option 2`] = `
exports[`change option 3`] = ` exports[`change option 3`] = `
<div class="van-picker van-area"> <div class="van-picker van-area">
<div class="van-hairline--top-bottom van-picker__toolbar"> <div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">取消</div> <div class="van-picker__cancel">
取消
</div>
<!----> <!---->
<div class="van-picker__confirm">确认</div> <div class="van-picker__confirm">
确认
</div>
</div> </div>
<!----> <!---->
<div class="van-picker__columns" style="height: 220px;"> <div class="van-picker__columns" style="height: 220px;">
@ -90,9 +102,13 @@ exports[`change option 3`] = `
exports[`reset method 1`] = ` exports[`reset method 1`] = `
<div class="van-picker van-area"> <div class="van-picker van-area">
<div class="van-hairline--top-bottom van-picker__toolbar"> <div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">取消</div> <div class="van-picker__cancel">
取消
</div>
<!----> <!---->
<div class="van-picker__confirm">确认</div> <div class="van-picker__confirm">
确认
</div>
</div> </div>
<!----> <!---->
<div class="van-picker__columns" style="height: 220px;"> <div class="van-picker__columns" style="height: 220px;">
@ -121,9 +137,13 @@ exports[`reset method 1`] = `
exports[`reset method 2`] = ` exports[`reset method 2`] = `
<div class="van-picker van-area"> <div class="van-picker van-area">
<div class="van-hairline--top-bottom van-picker__toolbar"> <div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">取消</div> <div class="van-picker__cancel">
取消
</div>
<!----> <!---->
<div class="van-picker__confirm">确认</div> <div class="van-picker__confirm">
确认
</div>
</div> </div>
<!----> <!---->
<div class="van-picker__columns" style="height: 220px;"> <div class="van-picker__columns" style="height: 220px;">
@ -153,9 +173,13 @@ exports[`reset method 2`] = `
exports[`watch areaList & code 1`] = ` exports[`watch areaList & code 1`] = `
<div class="van-picker van-area"> <div class="van-picker van-area">
<div class="van-hairline--top-bottom van-picker__toolbar"> <div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">取消</div> <div class="van-picker__cancel">
取消
</div>
<!----> <!---->
<div class="van-picker__confirm">确认</div> <div class="van-picker__confirm">
确认
</div>
</div> </div>
<!----> <!---->
<div class="van-picker__columns" style="height: 220px;"> <div class="van-picker__columns" style="height: 220px;">
@ -176,9 +200,13 @@ exports[`watch areaList & code 1`] = `
exports[`watch areaList & code 2`] = ` exports[`watch areaList & code 2`] = `
<div class="van-picker van-area"> <div class="van-picker van-area">
<div class="van-hairline--top-bottom van-picker__toolbar"> <div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">取消</div> <div class="van-picker__cancel">
取消
</div>
<!----> <!---->
<div class="van-picker__confirm">确认</div> <div class="van-picker__confirm">
确认
</div>
</div> </div>
<!----> <!---->
<div class="van-picker__columns" style="height: 220px;"> <div class="van-picker__columns" style="height: 220px;">
@ -208,9 +236,13 @@ exports[`watch areaList & code 2`] = `
exports[`watch areaList & code 3`] = ` exports[`watch areaList & code 3`] = `
<div class="van-picker van-area"> <div class="van-picker van-area">
<div class="van-hairline--top-bottom van-picker__toolbar"> <div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">取消</div> <div class="van-picker__cancel">
取消
</div>
<!----> <!---->
<div class="van-picker__confirm">确认</div> <div class="van-picker__confirm">
确认
</div>
</div> </div>
<!----> <!---->
<div class="van-picker__columns" style="height: 220px;"> <div class="van-picker__columns" style="height: 220px;">

View File

@ -1,5 +1,8 @@
<template> <template>
<div :class="b()" class="van-hairline--top-bottom"> <div
:class="b()"
class="van-hairline--top-bottom"
>
<slot /> <slot />
</div> </div>
</template> </template>

View File

@ -1,11 +1,23 @@
<template> <template>
<demo-section> <demo-section>
<demo-block :title="$t('basicUsage')"> <demo-block :title="$t('basicUsage')">
<van-badge-group :active-key="activeKey" @change="onChange"> <van-badge-group
:active-key="activeKey"
@change="onChange"
>
<van-badge :title="$t('title')" /> <van-badge :title="$t('title')" />
<van-badge :title="$t('title')" info="8" /> <van-badge
<van-badge :title="$t('title')" info="99" /> :title="$t('title')"
<van-badge :title="$t('title')" info="199" /> info="8"
/>
<van-badge
:title="$t('title')"
info="99"
/>
<van-badge
:title="$t('title')"
info="199"
/>
</van-badge-group> </van-badge-group>
</demo-block> </demo-block>
</demo-section> </demo-section>

View File

@ -4,7 +4,10 @@
:href="url" :href="url"
@click="onClick" @click="onClick"
> >
<van-info :info="info" :class="b('info')" /> <van-info
:info="info"
:class="b('info')"
/>
{{ title }} {{ title }}
</a> </a>
</template> </template>

View File

@ -9,15 +9,21 @@ exports[`renders demo correctly 1`] = `
标签名称 标签名称
</a> </a>
<a class="van-badge van-hairline"> <a class="van-badge van-hairline">
<div class="van-info van-badge__info">8</div> <div class="van-info van-badge__info">
8
</div>
标签名称 标签名称
</a> </a>
<a class="van-badge van-hairline"> <a class="van-badge van-hairline">
<div class="van-info van-badge__info">99</div> <div class="van-info van-badge__info">
99
</div>
标签名称 标签名称
</a> </a>
<a class="van-badge van-hairline"> <a class="van-badge van-hairline">
<div class="van-info van-badge__info">199</div> <div class="van-info van-badge__info">
199
</div>
标签名称 标签名称
</a> </a>
</div> </div>

View File

@ -10,23 +10,59 @@
</demo-block> </demo-block>
<demo-block :title="$t('plain')"> <demo-block :title="$t('plain')">
<van-button plain type="primary">{{ $t('plain') }}</van-button> <van-button
<van-button plain type="danger">{{ $t('plain') }}</van-button> plain
type="primary"
>
{{ $t('plain') }}
</van-button>
<van-button
plain
type="danger"
>
{{ $t('plain') }}
</van-button>
</demo-block> </demo-block>
<demo-block :title="$t('disabled')"> <demo-block :title="$t('disabled')">
<van-button disabled type="primary">{{ $t('disabled') }}</van-button> <van-button
<van-button disabled type="danger">{{ $t('disabled') }}</van-button> disabled
type="primary"
>
{{ $t('disabled') }}
</van-button>
<van-button
disabled
type="danger"
>
{{ $t('disabled') }}
</van-button>
</demo-block> </demo-block>
<demo-block :title="$t('loading')"> <demo-block :title="$t('loading')">
<van-button loading type="primary" /> <van-button
<van-button loading type="danger" /> loading
type="primary"
/>
<van-button
loading
type="danger"
/>
</demo-block> </demo-block>
<demo-block :title="$t('shape')"> <demo-block :title="$t('shape')">
<van-button type="primary" square>{{ $t('square') }}</van-button> <van-button
<van-button type="danger" round>{{ $t('round') }}</van-button> type="primary"
square
>
{{ $t('square') }}
</van-button>
<van-button
type="danger"
round
>
{{ $t('round') }}
</van-button>
</demo-block> </demo-block>
<demo-block :title="$t('size')"> <demo-block :title="$t('size')">

View File

@ -19,8 +19,15 @@
])" ])"
@click="onClick" @click="onClick"
> >
<loading v-if="loading" size="20px" :color="type === 'default' ? void 0 : ''" /> <loading
<span v-else :class="b('text')"> v-if="loading"
size="20px"
:color="type === 'default' ? void 0 : ''"
/>
<span
v-else
:class="b('text')"
>
<slot>{{ text }}</slot> <slot>{{ text }}</slot>
</span> </span>
</component> </component>

View File

@ -11,12 +11,20 @@ exports[`renders demo correctly 1`] = `
<button class="van-button van-button--warning van-button--normal"><span class="van-button__text">警告按钮</span></button> <button class="van-button van-button--warning van-button--normal"><span class="van-button__text">警告按钮</span></button>
</div> </div>
<div> <div>
<button class="van-button van-button--primary van-button--normal van-button--plain"><span class="van-button__text">朴素按钮</span></button> <button class="van-button van-button--primary van-button--normal van-button--plain"><span class="van-button__text">
<button class="van-button van-button--danger van-button--normal van-button--plain"><span class="van-button__text">朴素按钮</span></button> 朴素按钮
</span></button>
<button class="van-button van-button--danger van-button--normal van-button--plain"><span class="van-button__text">
朴素按钮
</span></button>
</div> </div>
<div> <div>
<button disabled="disabled" class="van-button van-button--primary van-button--normal van-button--disabled van-button--unclickable"><span class="van-button__text">禁用状态</span></button> <button disabled="disabled" class="van-button van-button--primary van-button--normal van-button--disabled van-button--unclickable"><span class="van-button__text">
<button disabled="disabled" class="van-button van-button--danger van-button--normal van-button--disabled van-button--unclickable"><span class="van-button__text">禁用状态</span></button> 禁用状态
</span></button>
<button disabled="disabled" class="van-button van-button--danger van-button--normal van-button--disabled van-button--unclickable"><span class="van-button__text">
禁用状态
</span></button>
</div> </div>
<div> <div>
<button class="van-button van-button--primary van-button--normal van-button--loading van-button--unclickable"> <button class="van-button van-button--primary van-button--normal van-button--loading van-button--unclickable">
@ -27,8 +35,12 @@ exports[`renders demo correctly 1`] = `
</button> </button>
</div> </div>
<div> <div>
<button class="van-button van-button--primary van-button--normal van-button--square"><span class="van-button__text">方形按钮</span></button> <button class="van-button van-button--primary van-button--normal van-button--square"><span class="van-button__text">
<button class="van-button van-button--danger van-button--normal van-button--round"><span class="van-button__text">圆形按钮</span></button> 方形按钮
</span></button>
<button class="van-button van-button--danger van-button--normal van-button--round"><span class="van-button__text">
圆形按钮
</span></button>
</div> </div>
<div> <div>
<button class="van-button van-button--default van-button--large"><span class="van-button__text">大号按钮</span></button> <button class="van-button van-button--default van-button--large"><span class="van-button__text">大号按钮</span></button>

View File

@ -1,8 +1,14 @@
<template> <template>
<div :class="b({ center: centered })"> <div :class="b({ center: centered })">
<a :href="thumbLink" :class="b('thumb')"> <a
:href="thumbLink"
:class="b('thumb')"
>
<slot name="thumb"> <slot name="thumb">
<img :src="thumb" :class="b('img')"> <img
:src="thumb"
:class="b('img')"
>
</slot> </slot>
<van-tag <van-tag
v-if="tag" v-if="tag"
@ -16,20 +22,43 @@
<div :class="b('content')"> <div :class="b('content')">
<div :class="b('left')"> <div :class="b('left')">
<slot name="title"> <slot name="title">
<div v-if="title" :class="b('title')">{{ title }}</div> <div
v-if="title"
:class="b('title')"
>
{{ title }}
</div>
</slot> </slot>
<slot name="desc"> <slot name="desc">
<div v-if="desc" :class="[b('desc'), 'van-ellipsis']">{{ desc }}</div> <div
v-if="desc"
:class="[b('desc'), 'van-ellipsis']"
>
{{ desc }}
</div>
</slot> </slot>
<slot name="tags" /> <slot name="tags" />
</div> </div>
<div :class="b('right')"> <div :class="b('right')">
<div v-if="isDef(price)">{{ currency }} {{ price }}</div> <div v-if="isDef(price)">{{ currency }} {{ price }}</div>
<div v-if="isDef(originPrice)" :class="b('origin-price')">{{ currency }} {{ originPrice }}</div> <div
<div v-if="isDef(num)" :class="b('num')">x {{ num }}</div> v-if="isDef(originPrice)"
:class="b('origin-price')"
>
{{ currency }} {{ originPrice }}
</div>
<div
v-if="isDef(num)"
:class="b('num')"
>
x {{ num }}
</div>
</div> </div>
</div> </div>
<div :class="b('footer')" v-if="$slots.footer"> <div
:class="b('footer')"
v-if="$slots.footer"
>
<slot name="footer" /> <slot name="footer" />
</div> </div>
</div> </div>

View File

@ -10,13 +10,19 @@ exports[`renders demo correctly 1`] = `
</a> </a>
<div class="van-card__content"> <div class="van-card__content">
<div class="van-card__left"> <div class="van-card__left">
<div class="van-card__title">商品标题</div> <div class="van-card__title">
<div class="van-card__desc van-ellipsis">描述信息</div> 商品标题
</div>
<div class="van-card__desc van-ellipsis">
描述信息
</div>
</div> </div>
<div class="van-card__right"> <div class="van-card__right">
<div>¥ 2.00</div> <div>¥ 2.00</div>
<!----> <!---->
<div class="van-card__num">x 2</div> <div class="van-card__num">
x 2
</div>
</div> </div>
</div> </div>
<!----> <!---->
@ -30,13 +36,21 @@ exports[`renders demo correctly 1`] = `
</span></a> </span></a>
<div class="van-card__content"> <div class="van-card__content">
<div class="van-card__left"> <div class="van-card__left">
<div class="van-card__title">商品标题</div> <div class="van-card__title">
<div class="van-card__desc van-ellipsis">描述信息</div> 商品标题
</div>
<div class="van-card__desc van-ellipsis">
描述信息
</div>
</div> </div>
<div class="van-card__right"> <div class="van-card__right">
<div>¥ 2.00</div> <div>¥ 2.00</div>
<div class="van-card__origin-price">¥ 10.00</div> <div class="van-card__origin-price">
<div class="van-card__num">x 2</div> ¥ 10.00
</div>
<div class="van-card__num">
x 2
</div>
</div> </div>
</div> </div>
<div class="van-card__footer"> <div class="van-card__footer">

View File

@ -2,18 +2,38 @@
<demo-section> <demo-section>
<demo-block :title="$t('basicUsage')"> <demo-block :title="$t('basicUsage')">
<van-cell-group> <van-cell-group>
<van-cell :title="$t('cell')" :value="$t('content')" /> <van-cell
<van-cell :title="$t('cell')" :value="$t('content')" :label="$t('desc')" /> :title="$t('cell')"
:value="$t('content')"
/>
<van-cell
:title="$t('cell')"
:value="$t('content')"
:label="$t('desc')"
/>
</van-cell-group> </van-cell-group>
</demo-block> </demo-block>
<demo-block :title="$t('largeSize')"> <demo-block :title="$t('largeSize')">
<van-cell :title="$t('cell')" :value="$t('content')" size="large" /> <van-cell
<van-cell :title="$t('cell')" :value="$t('content')" size="large" :label="$t('desc')" /> :title="$t('cell')"
:value="$t('content')"
size="large"
/>
<van-cell
:title="$t('cell')"
:value="$t('content')"
size="large"
:label="$t('desc')"
/>
</demo-block> </demo-block>
<demo-block :title="$t('showIcon')"> <demo-block :title="$t('showIcon')">
<van-cell :title="$t('cell')" :value="$t('content')" icon="location" /> <van-cell
:title="$t('cell')"
:value="$t('content')"
icon="location"
/>
</demo-block> </demo-block>
<demo-block :title="$t('valueOnly')"> <demo-block :title="$t('valueOnly')">
@ -21,26 +41,58 @@
</demo-block> </demo-block>
<demo-block :title="$t('showArrow')"> <demo-block :title="$t('showArrow')">
<van-cell :title="$t('cell')" is-link /> <van-cell
<van-cell :title="$t('cell')" is-link :value="$t('content')" /> :title="$t('cell')"
<van-cell :title="$t('cell')" is-link arrow-direction="down" :value="$t('content')" /> is-link
/>
<van-cell
:title="$t('cell')"
is-link
:value="$t('content')"
/>
<van-cell
:title="$t('cell')"
is-link
arrow-direction="down"
:value="$t('content')"
/>
</demo-block> </demo-block>
<demo-block :title="$t('router')"> <demo-block :title="$t('router')">
<van-cell :title="$t('cell')" is-link url="//youzan.github.io/vant/mobile.html" /> <van-cell
<van-cell :title="$t('cell')" is-link to="index" /> :title="$t('cell')"
is-link
url="//youzan.github.io/vant/mobile.html"
/>
<van-cell
:title="$t('cell')"
is-link
to="index"
/>
</demo-block> </demo-block>
<demo-block :title="$t('advancedUsage')"> <demo-block :title="$t('advancedUsage')">
<van-cell :value="$t('content')" icon="shop" is-link> <van-cell
:value="$t('content')"
icon="shop"
is-link
>
<template slot="title"> <template slot="title">
<span class="custom-text">{{ $t('cell') }}</span> <span class="custom-text">{{ $t('cell') }}</span>
<van-tag type="danger">{{ $t('tag') }}</van-tag> <van-tag type="danger">{{ $t('tag') }}</van-tag>
</template> </template>
</van-cell> </van-cell>
<van-cell :title="$t('cell')" icon="location" is-link /> <van-cell
:title="$t('cell')"
icon="location"
is-link
/>
<van-cell :title="$t('cell')"> <van-cell :title="$t('cell')">
<van-icon slot="right-icon" name="search" class="custom-icon" /> <van-icon
slot="right-icon"
name="search"
class="custom-icon"
/>
</van-cell> </van-cell>
</demo-block> </demo-block>
</demo-section> </demo-section>

View File

@ -12,12 +12,23 @@
@click="onClick" @click="onClick"
> >
<slot name="icon"> <slot name="icon">
<icon v-if="icon" :class="b('left-icon')" :name="icon" /> <icon
v-if="icon"
:class="b('left-icon')"
:name="icon"
/>
</slot> </slot>
<div v-if="isDef(title) || $slots.title" :class="b('title')"> <div
v-if="isDef(title) || $slots.title"
:class="b('title')"
>
<slot name="title"> <slot name="title">
<span v-text="title" /> <span v-text="title" />
<div v-if="label" v-text="label" :class="b('label')" /> <div
v-if="label"
v-text="label"
:class="b('label')"
/>
</slot> </slot>
</div> </div>
<div <div
@ -29,7 +40,11 @@
</slot> </slot>
</div> </div>
<slot name="right-icon"> <slot name="right-icon">
<icon v-if="isLink" :class="b('right-icon', arrowDirection)" name="arrow" /> <icon
v-if="isLink"
:class="b('right-icon', arrowDirection)"
name="arrow"
/>
</slot> </slot>
<slot name="extra" /> <slot name="extra" />
</div> </div>

View File

@ -5,12 +5,25 @@
</demo-block> </demo-block>
<demo-block :title="$t('disabled')"> <demo-block :title="$t('disabled')">
<van-checkbox :value="false" disabled>{{ $t('checkbox') }}</van-checkbox> <van-checkbox
<van-checkbox :value="true" disabled>{{ $t('checkbox') }}</van-checkbox> :value="false"
disabled
>
{{ $t('checkbox') }}
</van-checkbox>
<van-checkbox
:value="true"
disabled
>
{{ $t('checkbox') }}
</van-checkbox>
</demo-block> </demo-block>
<demo-block :title="$t('customColor')"> <demo-block :title="$t('customColor')">
<van-checkbox v-model="checkbox2" checked-color="#4b0"> <van-checkbox
v-model="checkbox2"
checked-color="#4b0"
>
{{ $t('customColor') }} {{ $t('customColor') }}
</van-checkbox> </van-checkbox>
</demo-block> </demo-block>
@ -39,7 +52,10 @@
</demo-block> </demo-block>
<demo-block :title="$t('title4')"> <demo-block :title="$t('title4')">
<van-checkbox-group v-model="result2" :max="2"> <van-checkbox-group
v-model="result2"
:max="2"
>
<van-checkbox <van-checkbox
v-for="(item, index) in list" v-for="(item, index) in list"
:key="index" :key="index"
@ -60,7 +76,10 @@
:title="$t('checkbox') + item" :title="$t('checkbox') + item"
@click="toggle(index)" @click="toggle(index)"
> >
<van-checkbox ref="checkboxes" :name="item" /> <van-checkbox
ref="checkboxes"
:name="item"
/>
</van-cell> </van-cell>
</van-cell-group> </van-cell-group>
</van-checkbox-group> </van-checkbox-group>

View File

@ -1,11 +1,24 @@
<template> <template>
<div :class="b()"> <div :class="b()">
<div :class="[b('icon', [shape, { disabled: isDisabled, checked }])]" @click="toggle"> <div
<slot name="icon" :checked="checked"> :class="[b('icon', [shape, { disabled: isDisabled, checked }])]"
<icon name="success" :style="iconStyle" /> @click="toggle"
>
<slot
name="icon"
:checked="checked"
>
<icon
name="success"
:style="iconStyle"
/>
</slot> </slot>
</div> </div>
<span v-if="$slots.default" :class="b('label', labelPosition)" @click="toggle('label')"> <span
v-if="$slots.default"
:class="b('label', labelPosition)"
@click="toggle('label')"
>
<slot /> <slot />
</span> </span>
</div> </div>

View File

@ -16,13 +16,17 @@ exports[`renders demo correctly 1`] = `
<i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;"> <i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<!----> <!---->
</i> </i>
</div> <span class="van-checkbox__label">复选框</span></div> </div> <span class="van-checkbox__label">
复选框
</span></div>
<div class="van-checkbox"> <div class="van-checkbox">
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--disabled van-checkbox__icon--checked"> <div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--disabled van-checkbox__icon--checked">
<i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;"> <i class="van-icon van-icon-success" style="color:undefined;font-size:undefined;">
<!----> <!---->
</i> </i>
</div> <span class="van-checkbox__label">复选框</span></div> </div> <span class="van-checkbox__label">
复选框
</span></div>
</div> </div>
<div> <div>
<div class="van-checkbox"> <div class="van-checkbox">

View File

@ -21,8 +21,18 @@
:text="currentRate2.toFixed(0) + '%'" :text="currentRate2.toFixed(0) + '%'"
/> />
<div> <div>
<van-button :text="$t('add')" type="primary" size="small" @click="add" /> <van-button
<van-button :text="$t('decrease')" type="danger" size="small" @click="reduce" /> :text="$t('add')"
type="primary"
size="small"
@click="add"
/>
<van-button
:text="$t('decrease')"
type="danger"
size="small"
@click="reduce"
/>
</div> </div>
</demo-block> </demo-block>
</demo-section> </demo-section>

View File

@ -1,8 +1,19 @@
<template> <template>
<div :class="b()" :style="style"> <div
:class="b()"
:style="style"
>
<svg viewBox="0 0 1060 1060"> <svg viewBox="0 0 1060 1060">
<path :class="b('hover')" :style="hoverStyle" :d="path" /> <path
<path :class="b('layer')" :style="layerStyle" :d="path" /> :class="b('hover')"
:style="hoverStyle"
:d="path"
/>
<path
:class="b('layer')"
:style="layerStyle"
:d="path"
/>
</svg> </svg>
<slot> <slot>
<div :class="b('text')">{{ text }}</div> <div :class="b('text')">{{ text }}</div>

View File

@ -9,11 +9,21 @@
<van-row> <van-row>
<van-col span="4">span: 4</van-col> <van-col span="4">span: 4</van-col>
<van-col span="10" offset="4">offset: 4, span: 10</van-col> <van-col
span="10"
offset="4"
>
offset: 4, span: 10
</van-col>
</van-row> </van-row>
<van-row> <van-row>
<van-col offset="12" span="12">offset: 12, span: 12</van-col> <van-col
offset="12"
span="12"
>
offset: 12, span: 12
</van-col>
</van-row> </van-row>
</demo-block> </demo-block>
@ -32,25 +42,37 @@
<van-col span="6">span: 6</van-col> <van-col span="6">span: 6</van-col>
</van-row> </van-row>
<van-row type="flex" justify="center"> <van-row
type="flex"
justify="center"
>
<van-col span="6">span: 6</van-col> <van-col span="6">span: 6</van-col>
<van-col span="6">span: 6</van-col> <van-col span="6">span: 6</van-col>
<van-col span="6">span: 6</van-col> <van-col span="6">span: 6</van-col>
</van-row> </van-row>
<van-row type="flex" justify="end"> <van-row
type="flex"
justify="end"
>
<van-col span="6">span: 6</van-col> <van-col span="6">span: 6</van-col>
<van-col span="6">span: 6</van-col> <van-col span="6">span: 6</van-col>
<van-col span="6">span: 6</van-col> <van-col span="6">span: 6</van-col>
</van-row> </van-row>
<van-row type="flex" justify="space-between"> <van-row
type="flex"
justify="space-between"
>
<van-col span="6">span: 6</van-col> <van-col span="6">span: 6</van-col>
<van-col span="6">span: 6</van-col> <van-col span="6">span: 6</van-col>
<van-col span="6">span: 6</van-col> <van-col span="6">span: 6</van-col>
</van-row> </van-row>
<van-row type="flex" justify="space-around"> <van-row
type="flex"
justify="space-around"
>
<van-col span="6">span: 6</van-col> <van-col span="6">span: 6</van-col>
<van-col span="6">span: 6</van-col> <van-col span="6">span: 6</van-col>
<van-col span="6">span: 6</van-col> <van-col span="6">span: 6</van-col>

View File

@ -10,10 +10,14 @@ exports[`renders demo correctly 1`] = `
</div> </div>
<div class="van-row"> <div class="van-row">
<div class="van-col van-col--4">span: 4</div> <div class="van-col van-col--4">span: 4</div>
<div class="van-col van-col--10 van-col--offset-4">offset: 4, span: 10</div> <div class="van-col van-col--10 van-col--offset-4">
offset: 4, span: 10
</div>
</div> </div>
<div class="van-row"> <div class="van-row">
<div class="van-col van-col--12 van-col--offset-12">offset: 12, span: 12</div> <div class="van-col van-col--12 van-col--offset-12">
offset: 12, span: 12
</div>
</div> </div>
</div> </div>
<div> <div>

View File

@ -5,13 +5,31 @@
:class="b('title', { disabled, expanded })" :class="b('title', { disabled, expanded })"
@click="onClick" @click="onClick"
> >
<slot name="title" slot="title" /> <slot
<slot name="icon" slot="icon" /> name="title"
slot="title"
/>
<slot
name="icon"
slot="icon"
/>
<slot name="value" /> <slot name="value" />
<slot name="right-icon" slot="right-icon" /> <slot
name="right-icon"
slot="right-icon"
/>
</cell> </cell>
<div v-if="inited" v-show="show" ref="wrapper" :class="b('wrapper')" @transitionend="onTransitionEnd"> <div
<div ref="content" :class="b('content')"> v-if="inited"
v-show="show"
ref="wrapper"
:class="b('wrapper')"
@transitionend="onTransitionEnd"
>
<div
ref="content"
:class="b('content')"
>
<slot /> <slot />
</div> </div>
</div> </div>

View File

@ -4,12 +4,20 @@
<van-collapse v-model="active1"> <van-collapse v-model="active1">
<van-collapse-item :title="$t('title1')">{{ $t('content1') }}</van-collapse-item> <van-collapse-item :title="$t('title1')">{{ $t('content1') }}</van-collapse-item>
<van-collapse-item :title="$t('title2')">{{ $t('content2') }}</van-collapse-item> <van-collapse-item :title="$t('title2')">{{ $t('content2') }}</van-collapse-item>
<van-collapse-item :title="$t('title3')" disabled>{{ $t('content3') }}</van-collapse-item> <van-collapse-item
:title="$t('title3')"
disabled
>
{{ $t('content3') }}
</van-collapse-item>
</van-collapse> </van-collapse>
</demo-block> </demo-block>
<demo-block :title="$t('accordion')"> <demo-block :title="$t('accordion')">
<van-collapse v-model="active2" accordion> <van-collapse
v-model="active2"
accordion
>
<van-collapse-item :title="$t('title1')">{{ $t('content1') }}</van-collapse-item> <van-collapse-item :title="$t('title1')">{{ $t('content1') }}</van-collapse-item>
<van-collapse-item :title="$t('title2')">{{ $t('content2') }}</van-collapse-item> <van-collapse-item :title="$t('title2')">{{ $t('content2') }}</van-collapse-item>
<van-collapse-item :title="$t('title3')">{{ $t('content3') }}</van-collapse-item> <van-collapse-item :title="$t('title3')">{{ $t('content3') }}</van-collapse-item>
@ -22,7 +30,11 @@
<div slot="title">{{ $t('title1') }}<van-icon name="question" /></div> <div slot="title">{{ $t('title1') }}<van-icon name="question" /></div>
{{ $t('content1') }} {{ $t('content1') }}
</van-collapse-item> </van-collapse-item>
<van-collapse-item :title="$t('title2')" :value="$t('content')" icon="shop"> <van-collapse-item
:title="$t('title2')"
:value="$t('content')"
icon="shop"
>
{{ $t('content2') }} {{ $t('content2') }}
</van-collapse-item> </van-collapse-item>
</van-collapse> </van-collapse>

View File

@ -1,5 +1,8 @@
<template> <template>
<div :class="b()" class="van-hairline--top-bottom"> <div
:class="b()"
class="van-hairline--top-bottom"
>
<slot /> <slot />
</div> </div>
</template> </template>

View File

@ -8,7 +8,11 @@
@click="showList = true" @click="showList = true"
/> />
<van-popup v-model="showList" position="bottom" :lazy-render="false"> <van-popup
v-model="showList"
position="bottom"
:lazy-render="false"
>
<van-contact-list <van-contact-list
v-model="chosenContactId" v-model="chosenContactId"
:list="list" :list="list"
@ -18,7 +22,11 @@
/> />
</van-popup> </van-popup>
<van-popup v-model="showEdit" position="bottom" :lazy-render="false"> <van-popup
v-model="showEdit"
position="bottom"
:lazy-render="false"
>
<van-contact-edit <van-contact-edit
:contact-info="editingContact" :contact-info="editingContact"
:is-edit="isEdit" :is-edit="isEdit"
@ -61,10 +69,6 @@ export default {
}; };
}, },
created() {
this.list.push(this.mockContact);
},
computed: { computed: {
mockContact() { mockContact() {
return { return {
@ -84,6 +88,10 @@ export default {
} }
}, },
created() {
this.list.push(this.mockContact);
},
methods: { methods: {
onAdd() { onAdd() {
this.editingContact = { id: this.list.length }; this.editingContact = { id: this.list.length };

View File

@ -69,7 +69,9 @@ exports[`renders demo correctly 1`] = `
</div> </div>
</div> </div>
<div class="van-contact-edit__buttons"> <div class="van-contact-edit__buttons">
<button class="van-button van-button--danger van-button--normal van-button--block"><span class="van-button__text">保存</span></button> <button class="van-button van-button--danger van-button--normal van-button--block"><span class="van-button__text">
保存
</span></button>
<!----> <!---->
</div> </div>
</div> </div>

View File

@ -19,8 +19,22 @@
/> />
</cell-group> </cell-group>
<div :class="b('buttons')"> <div :class="b('buttons')">
<van-button block :loading="isSaving" @click="onSave" type="danger">{{ $t('save') }}</van-button> <van-button
<van-button block :loading="isDeleting" @click="onDelete" v-if="isEdit">{{ $t('delete') }}</van-button> block
:loading="isSaving"
@click="onSave"
type="danger"
>
{{ $t('save') }}
</van-button>
<van-button
block
:loading="isDeleting"
@click="onDelete"
v-if="isEdit"
>
{{ $t('delete') }}
</van-button>
</div> </div>
</div> </div>
</template> </template>

View File

@ -1,9 +1,19 @@
<template> <template>
<div :class="b()"> <div :class="b()">
<radio-group :value="value" @input="$emit('input', $event)"> <radio-group
:value="value"
@input="$emit('input', $event)"
>
<cell-group> <cell-group>
<cell v-for="(item, index) in list" :key="item.id" is-link> <cell
<radio :name="item.id" @click="$emit('select', item, index)"> v-for="(item, index) in list"
:key="item.id"
is-link
>
<radio
:name="item.id"
@click="$emit('select', item, index)"
>
<div :class="b('name')">{{ item.name }}{{ item.tel }}</div> <div :class="b('name')">{{ item.name }}{{ item.tel }}</div>
</radio> </radio>
<icon <icon

View File

@ -1,5 +1,8 @@
<template> <template>
<cell-group :class="b()" :border="border"> <cell-group
:class="b()"
:border="border"
>
<cell <cell
:title="title || $t('title')" :title="title || $t('title')"
:value="value" :value="value"

View File

@ -8,10 +8,19 @@
<div :class="b('body')"> <div :class="b('body')">
<h2>{{ data.name }}</h2> <h2>{{ data.name }}</h2>
<p>{{ validPeriod }}</p> <p>{{ validPeriod }}</p>
<checkbox v-if="chosen" :class="b('corner')" :value="true" /> <checkbox
v-if="chosen"
:class="b('corner')"
value
/>
</div> </div>
</div> </div>
<p v-if="disabled && data.reason" :class="b('reason')">{{ data.reason }}</p> <p
v-if="disabled && data.reason"
:class="b('reason')"
>
{{ data.reason }}
</p>
</div> </div>
</template> </template>

View File

@ -7,7 +7,10 @@
@click="showList = true" @click="showList = true"
/> />
<van-popup v-model="showList" position="bottom"> <van-popup
v-model="showList"
position="bottom"
>
<van-coupon-list <van-coupon-list
:coupons="coupons" :coupons="coupons"
:chosen-coupon="chosenCoupon" :chosen-coupon="chosenCoupon"

View File

@ -20,9 +20,16 @@
@click="onClickExchangeButton" @click="onClickExchangeButton"
/> />
</field> </field>
<tabs v-model="tab" :class="b('tab')" :line-width="120"> <tabs
v-model="tab"
:class="b('tab')"
:line-width="120"
>
<tab :title="title"> <tab :title="title">
<div :class="b('list')" :style="listStyle"> <div
:class="b('list')"
:style="listStyle"
>
<coupon-item <coupon-item
ref="card" ref="card"
v-for="(item, index) in coupons" v-for="(item, index) in coupons"
@ -31,21 +38,30 @@
:chosen="index === chosenCoupon" :chosen="index === chosenCoupon"
@click.native="$emit('change', index)" @click.native="$emit('change', index)"
/> />
<div v-if="!coupons.length" :class="b('empty')"> <div
v-if="!coupons.length"
:class="b('empty')"
>
<img src="https://img.yzcdn.cn/v2/image/wap/trade/new_order/empty@2x.png" > <img src="https://img.yzcdn.cn/v2/image/wap/trade/new_order/empty@2x.png" >
<p>{{ $t('empty') }}</p> <p>{{ $t('empty') }}</p>
</div> </div>
</div> </div>
</tab> </tab>
<tab :title="disabledTitle"> <tab :title="disabledTitle">
<div :class="b('list')" :style="listStyle"> <div
:class="b('list')"
:style="listStyle"
>
<coupon-item <coupon-item
disabled disabled
v-for="item in disabledCoupons" v-for="item in disabledCoupons"
:key="item.id || item.name" :key="item.id || item.name"
:data="item" :data="item"
/> />
<div v-if="!disabledCoupons.length" :class="b('empty')"> <div
v-if="!disabledCoupons.length"
:class="b('empty')"
>
<img src="https://img.yzcdn.cn/v2/image/wap/trade/new_order/empty@2x.png" > <img src="https://img.yzcdn.cn/v2/image/wap/trade/new_order/empty@2x.png" >
<p>{{ $t('empty') }}</p> <p>{{ $t('empty') }}</p>
</div> </div>

View File

@ -5,9 +5,13 @@ exports[`renders demo correctly 1`] = `
<div> <div>
<div class="van-picker"> <div class="van-picker">
<div class="van-hairline--top-bottom van-picker__toolbar"> <div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">取消</div> <div class="van-picker__cancel">
取消
</div>
<!----> <!---->
<div class="van-picker__confirm">确认</div> <div class="van-picker__confirm">
确认
</div>
</div> </div>
<!----> <!---->
<div class="van-picker__columns" style="height:220px;"> <div class="van-picker__columns" style="height:220px;">
@ -167,9 +171,13 @@ exports[`renders demo correctly 1`] = `
<div> <div>
<div class="van-picker"> <div class="van-picker">
<div class="van-hairline--top-bottom van-picker__toolbar"> <div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">取消</div> <div class="van-picker__cancel">
取消
</div>
<!----> <!---->
<div class="van-picker__confirm">确认</div> <div class="van-picker__confirm">
确认
</div>
</div> </div>
<!----> <!---->
<div class="van-picker__columns" style="height:220px;"> <div class="van-picker__columns" style="height:220px;">
@ -246,9 +254,13 @@ exports[`renders demo correctly 1`] = `
<div> <div>
<div class="van-picker"> <div class="van-picker">
<div class="van-hairline--top-bottom van-picker__toolbar"> <div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">取消</div> <div class="van-picker__cancel">
取消
</div>
<!----> <!---->
<div class="van-picker__confirm">确认</div> <div class="van-picker__confirm">
确认
</div>
</div> </div>
<!----> <!---->
<div class="van-picker__columns" style="height:220px;"> <div class="van-picker__columns" style="height:220px;">
@ -290,9 +302,13 @@ exports[`renders demo correctly 1`] = `
<div> <div>
<div class="van-picker"> <div class="van-picker">
<div class="van-hairline--top-bottom van-picker__toolbar"> <div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">取消</div> <div class="van-picker__cancel">
取消
</div>
<!----> <!---->
<div class="van-picker__confirm">确认</div> <div class="van-picker__confirm">
确认
</div>
</div> </div>
<!----> <!---->
<div class="van-picker__columns" style="height:220px;"> <div class="van-picker__columns" style="height:220px;">

View File

@ -1,13 +1,30 @@
<template> <template>
<transition name="van-dialog-bounce"> <transition name="van-dialog-bounce">
<div v-show="value" :class="[b(), className]"> <div
<div v-if="title" v-text="title" :class="b('header', { isolated: !message && !$slots.default })" /> v-show="value"
<div :class="b('content')" v-if="message || $slots.default"> :class="[b(), className]"
>
<div
v-if="title"
v-text="title"
:class="b('header', { isolated: !message && !$slots.default })"
/>
<div
:class="b('content')"
v-if="message || $slots.default"
>
<slot> <slot>
<div v-if="message" v-html="message" :class="b('message', { 'has-title': title })" /> <div
v-if="message"
v-html="message"
:class="b('message', { 'has-title': title })"
/>
</slot> </slot>
</div> </div>
<div class="van-hairline--top" :class="b('footer', { 'buttons': showCancelButton && showConfirmButton })"> <div
class="van-hairline--top"
:class="b('footer', { 'buttons': showCancelButton && showConfirmButton })"
>
<van-button <van-button
v-show="showCancelButton" v-show="showCancelButton"
:loading="loading.cancel" :loading="loading.cancel"

View File

@ -1,16 +1,40 @@
<template> <template>
<demo-section> <demo-section>
<demo-block :title="$t('alert1')"> <demo-block :title="$t('alert1')">
<van-button type="primary" plain @click="onClickAlert">{{ $t('alert1') }}</van-button> <van-button
<van-button type="primary" plain @click="onClickAlert2">{{ $t('alert2') }}</van-button> type="primary"
plain
@click="onClickAlert"
>
{{ $t('alert1') }}
</van-button>
<van-button
type="primary"
plain
@click="onClickAlert2"
>
{{ $t('alert2') }}
</van-button>
</demo-block> </demo-block>
<demo-block :title="$t('confirm')"> <demo-block :title="$t('confirm')">
<van-button type="primary" plain @click="onClickConfirm">{{ $t('confirm') }}</van-button> <van-button
type="primary"
plain
@click="onClickConfirm"
>
{{ $t('confirm') }}
</van-button>
</demo-block> </demo-block>
<demo-block :title="$t('advancedUsage')"> <demo-block :title="$t('advancedUsage')">
<van-button type="danger" plain @click="show = true">{{ $t('advancedUsage') }}</van-button> <van-button
type="danger"
plain
@click="show = true"
>
{{ $t('advancedUsage') }}
</van-button>
<van-dialog <van-dialog
v-model="show" v-model="show"
show-cancel-button show-cancel-button

View File

@ -3,14 +3,22 @@
exports[`renders demo correctly 1`] = ` exports[`renders demo correctly 1`] = `
<div> <div>
<div> <div>
<button class="van-button van-button--primary van-button--normal van-button--plain"><span class="van-button__text">消息提示</span></button> <button class="van-button van-button--primary van-button--normal van-button--plain"><span class="van-button__text">
<button class="van-button van-button--primary van-button--normal van-button--plain"><span class="van-button__text">无标题提示</span></button> 消息提示
</span></button>
<button class="van-button van-button--primary van-button--normal van-button--plain"><span class="van-button__text">
无标题提示
</span></button>
</div> </div>
<div> <div>
<button class="van-button van-button--primary van-button--normal van-button--plain"><span class="van-button__text">消息确认</span></button> <button class="van-button van-button--primary van-button--normal van-button--plain"><span class="van-button__text">
消息确认
</span></button>
</div> </div>
<div> <div>
<button class="van-button van-button--danger van-button--normal van-button--plain"><span class="van-button__text">高级用法</span></button> <button class="van-button van-button--danger van-button--normal van-button--plain"><span class="van-button__text">
高级用法
</span></button>
<div name="van-dialog-bounce" class="van-dialog" style="display:none;"> <div name="van-dialog-bounce" class="van-dialog" style="display:none;">
<!----> <!---->
<div class="van-dialog__content"> <div class="van-dialog__content">

View File

@ -2,7 +2,10 @@
<demo-section> <demo-section>
<demo-block :title="$t('basicUsage')"> <demo-block :title="$t('basicUsage')">
<van-cell-group> <van-cell-group>
<van-field v-model="value" :placeholder="$t('usernamePlaceholder')" /> <van-field
v-model="value"
:placeholder="$t('usernamePlaceholder')"
/>
</van-cell-group> </van-cell-group>
</demo-block> </demo-block>
@ -78,7 +81,13 @@
:label="$t('sms')" :label="$t('sms')"
:placeholder="$t('smsPlaceholder')" :placeholder="$t('smsPlaceholder')"
> >
<van-button slot="button" size="small" type="primary">{{ $t('sendSMS') }}</van-button> <van-button
slot="button"
size="small"
type="primary"
>
{{ $t('sendSMS') }}
</van-button>
</van-field> </van-field>
</van-cell-group> </van-cell-group>
</demo-block> </demo-block>

View File

@ -13,8 +13,14 @@
'min-height': type === 'textarea' && !autosize 'min-height': type === 'textarea' && !autosize
})" })"
> >
<slot name="left-icon" slot="icon" /> <slot
<slot name="label" slot="title" /> name="left-icon"
slot="icon"
/>
<slot
name="label"
slot="title"
/>
<div :class="b('body')"> <div :class="b('body')">
<textarea <textarea
v-if="type === 'textarea'" v-if="type === 'textarea'"
@ -41,12 +47,19 @@
:class="b('clear')" :class="b('clear')"
@touchstart.prevent="onClear" @touchstart.prevent="onClear"
/> />
<div v-if="$slots.icon || icon" :class="b('icon')" @click="onClickIcon"> <div
v-if="$slots.icon || icon"
:class="b('icon')"
@click="onClickIcon"
>
<slot name="icon"> <slot name="icon">
<icon :name="icon" /> <icon :name="icon" />
</slot> </slot>
</div> </div>
<div v-if="$slots.button" :class="b('button')"> <div
v-if="$slots.button"
:class="b('button')"
>
<slot name="button" /> <slot name="button" />
</div> </div>
</div> </div>

View File

@ -151,7 +151,9 @@ exports[`renders demo correctly 1`] = `
<!----> <!---->
<!----> <!---->
<div class="van-field__button"> <div class="van-field__button">
<button class="van-button van-button--primary van-button--small"><span class="van-button__text">发送验证码</span></button> <button class="van-button van-button--primary van-button--small"><span class="van-button__text">
发送验证码
</span></button>
</div> </div>
</div> </div>
<!----> <!---->

View File

@ -1,6 +1,14 @@
<template> <template>
<div :class="b()" class="van-hairline" @click="onClick"> <div
<icon :class="[b('icon'), iconClass]" :info="info" :name="icon" /> :class="b()"
class="van-hairline"
@click="onClick"
>
<icon
:class="[b('icon'), iconClass]"
:info="info"
:name="icon"
/>
<slot>{{ text }}</slot> <slot>{{ text }}</slot>
</div> </div>
</template> </template>

View File

@ -2,20 +2,55 @@
<demo-section> <demo-section>
<demo-block :title="$t('basicUsage')"> <demo-block :title="$t('basicUsage')">
<van-goods-action> <van-goods-action>
<van-goods-action-mini-btn icon="chat" :text="$t('icon1')" @click="onClickMiniBtn" /> <van-goods-action-mini-btn
<van-goods-action-mini-btn icon="cart" :text="$t('icon2')" @click="onClickMiniBtn" /> icon="chat"
<van-goods-action-big-btn :text="$t('button1')" @click="onClickBigBtn" /> :text="$t('icon1')"
<van-goods-action-big-btn :text="$t('button2')" @click="onClickBigBtn" primary /> @click="onClickMiniBtn"
/>
<van-goods-action-mini-btn
icon="cart"
:text="$t('icon2')"
@click="onClickMiniBtn"
/>
<van-goods-action-big-btn
:text="$t('button1')"
@click="onClickBigBtn"
/>
<van-goods-action-big-btn
primary
:text="$t('button2')"
@click="onClickBigBtn"
/>
</van-goods-action> </van-goods-action>
</demo-block> </demo-block>
<demo-block :title="$t('title2')"> <demo-block :title="$t('title2')">
<van-goods-action> <van-goods-action>
<van-goods-action-mini-btn icon="chat" :text="$t('icon1')" @click="onClickMiniBtn" /> <van-goods-action-mini-btn
<van-goods-action-mini-btn icon="cart" info="5" :text="$t('icon2')" @click="onClickMiniBtn" /> icon="chat"
<van-goods-action-mini-btn icon="shop" :text="$t('icon3')" @click="onClickMiniBtn" /> :text="$t('icon1')"
<van-goods-action-big-btn :text="$t('button1')" @click="onClickBigBtn" /> @click="onClickMiniBtn"
<van-goods-action-big-btn :text="$t('button2')" @click="onClickBigBtn" primary /> />
<van-goods-action-mini-btn
icon="cart"
info="5"
:text="$t('icon2')"
@click="onClickMiniBtn"
/>
<van-goods-action-mini-btn
icon="shop"
:text="$t('icon3')"
@click="onClickMiniBtn"
/>
<van-goods-action-big-btn
:text="$t('button1')"
@click="onClickBigBtn"
/>
<van-goods-action-big-btn
primary
:text="$t('button2')"
@click="onClickBigBtn"
/>
</van-goods-action> </van-goods-action>
</demo-block> </demo-block>
</demo-section> </demo-section>

View File

@ -24,7 +24,9 @@ exports[`renders demo correctly 1`] = `
</i> 客服</div> </i> 客服</div>
<div class="van-hairline van-goods-action-mini-btn"> <div class="van-hairline van-goods-action-mini-btn">
<i class="van-icon van-icon-cart van-goods-action-mini-btn__icon" style="color:undefined;font-size:undefined;"> <i class="van-icon van-icon-cart van-goods-action-mini-btn__icon" style="color:undefined;font-size:undefined;">
<div class="van-info">5</div> <div class="van-info">
5
</div>
</i> 购物车</div> </i> 购物车</div>
<div class="van-hairline van-goods-action-mini-btn"> <div class="van-hairline van-goods-action-mini-btn">
<i class="van-icon van-icon-shop van-goods-action-mini-btn__icon" style="color:undefined;font-size:undefined;"> <i class="van-icon van-icon-shop van-goods-action-mini-btn__icon" style="color:undefined;font-size:undefined;">

View File

@ -1,7 +1,11 @@
<template> <template>
<demo-section> <demo-section>
<demo-block :title="$t('title')"> <demo-block :title="$t('title')">
<van-col span="8" v-for="icon in icons" :key="icon"> <van-col
v-for="icon in icons"
:key="icon"
span="8"
>
<van-icon :name="icon" /> <van-icon :name="icon" />
<span>{{ icon }}</span> <span>{{ icon }}</span>
</van-col> </van-col>

View File

@ -1,5 +1,9 @@
<template> <template>
<i :class="[classPrefix, `${classPrefix}-${name}`]" :style="style" v-on="$listeners"> <i
v-on="$listeners"
:class="[classPrefix, `${classPrefix}-${name}`]"
:style="style"
>
<slot /> <slot />
<van-info :info="info" /> <van-info :info="info" />
</i> </i>

View File

@ -6,14 +6,22 @@
@touchend="onWrapperTouchEnd" @touchend="onWrapperTouchEnd"
@touchcancel="onWrapperTouchEnd" @touchcancel="onWrapperTouchEnd"
> >
<div v-if="showIndex" :class="b('index')">{{ active + 1 }}/{{ count }}</div> <div
v-if="showIndex"
:class="b('index')"
>
{{ active + 1 }}/{{ count }}
</div>
<swipe <swipe
ref="swipe" ref="swipe"
:initial-swipe="startPosition" :initial-swipe="startPosition"
:show-indicators="showIndicators" :show-indicators="showIndicators"
@change="onChange" @change="onChange"
> >
<swipe-item v-for="(item, index) in images" :key="index"> <swipe-item
v-for="(item, index) in images"
:key="index"
>
<img <img
:class="b('image')" :class="b('image')"
:src="item" :src="item"

View File

@ -2,7 +2,9 @@
exports[`render image 1`] = ` exports[`render image 1`] = `
<div class="van-image-preview"> <div class="van-image-preview">
<div class="van-image-preview__index">1/3</div> <div class="van-image-preview__index">
1/3
</div>
<div class="van-swipe"> <div class="van-swipe">
<div class="van-swipe__track" style="width: 0px;"> <div class="van-swipe__track" style="width: 0px;">
<div class="van-swipe-item" style="width: 0px; height: 100%;"> <div class="van-swipe-item" style="width: 0px; height: 100%;">
@ -22,7 +24,9 @@ exports[`render image 1`] = `
exports[`zoom 1`] = ` exports[`zoom 1`] = `
<div class="van-image-preview"> <div class="van-image-preview">
<div class="van-image-preview__index">1/3</div> <div class="van-image-preview__index">
1/3
</div>
<div class="van-swipe"> <div class="van-swipe">
<div class="van-swipe__track" style="width: 300px;"> <div class="van-swipe__track" style="width: 300px;">
<div class="van-swipe-item" style="width: 100px; height: 100%;"> <div class="van-swipe-item" style="width: 100px; height: 100%;">

View File

@ -1,5 +1,10 @@
<template> <template>
<div v-if="isDef(info)" :class="b()">{{ info }}</div> <div
v-if="isDef(info)"
:class="b()"
>
{{ info }}
</div>
</template> </template>
<script> <script>

View File

@ -1,16 +1,25 @@
<template> <template>
<demo-section> <demo-section>
<demo-block :title="$t('basicUsage')"> <demo-block :title="$t('basicUsage')">
<img v-for="img in imageList" v-lazy="img" > <img
v-for="img in imageList"
v-lazy="img"
>
</demo-block> </demo-block>
<demo-block :title="$t('title2')"> <demo-block :title="$t('title2')">
<div v-for="img in backgroundImageList" v-lazy:background-image="img" /> <div
v-for="img in backgroundImageList"
v-lazy:background-image="img"
/>
</demo-block> </demo-block>
<demo-block :title="$t('title3')"> <demo-block :title="$t('title3')">
<lazy-component> <lazy-component>
<img v-for="img in componentImageList" v-lazy="img" > <img
v-for="img in componentImageList"
v-lazy="img"
>
</lazy-component> </lazy-component>
</demo-block> </demo-block>
</demo-section> </demo-section>

View File

@ -2,13 +2,20 @@
<demo-section> <demo-section>
<demo-block :title="$t('basicUsage')"> <demo-block :title="$t('basicUsage')">
<p class="page-desc">{{ $t('text') }}</p> <p class="page-desc">{{ $t('text') }}</p>
<van-pull-refresh v-model="refreshing" @refresh="onRefresh"> <van-pull-refresh
v-model="refreshing"
@refresh="onRefresh"
>
<van-list <van-list
v-model="loading" v-model="loading"
:finished="finished" :finished="finished"
@load="onLoad" @load="onLoad"
> >
<van-cell v-for="item in list" :key="item" :title="item + ''" /> <van-cell
v-for="item in list"
:key="item"
:title="item + ''"
/>
</van-list> </van-list>
</van-pull-refresh> </van-pull-refresh>
</demo-block> </demo-block>

View File

@ -1,7 +1,10 @@
<template> <template>
<div :class="b()"> <div :class="b()">
<slot /> <slot />
<div v-show="loading" :class="b('loading')"> <div
v-show="loading"
:class="b('loading')"
>
<slot name="loading"> <slot name="loading">
<loading /> <loading />
<span :class="b('loading-text')">{{ loadingText || $t('loadingTip') }}</span> <span :class="b('loading-text')">{{ loadingText || $t('loadingTip') }}</span>

View File

@ -7,7 +7,10 @@
<demo-block :title="$t('title2')"> <demo-block :title="$t('title2')">
<van-loading type="spinner" /> <van-loading type="spinner" />
<van-loading type="spinner" color="white" /> <van-loading
type="spinner"
color="white"
/>
</demo-block> </demo-block>
</demo-section> </demo-section>
</template> </template>

View File

@ -1,9 +1,24 @@
<template> <template>
<div :class="b([type, colorType])" :style="style"> <div
:class="b([type, colorType])"
:style="style"
>
<span :class="b('spinner', type)"> <span :class="b('spinner', type)">
<i v-for="(item, index) in (type === 'spinner' ? 12 : 0)" :key="index" /> <i
<svg v-if="type === 'circular'" :class="b('circular')" viewBox="25 25 50 50"> v-for="(item, index) in (type === 'spinner' ? 12 : 0)"
<circle cx="50" cy="50" r="20" fill="none"/> :key="index"
/>
<svg
v-if="type === 'circular'"
:class="b('circular')"
viewBox="25 25 50 50"
>
<circle
cx="50"
cy="50"
r="20"
fill="none"
/>
</svg> </svg>
</span> </span>
</div> </div>

View File

@ -12,8 +12,15 @@
</demo-block> </demo-block>
<demo-block :title="$t('advancedUsage')"> <demo-block :title="$t('advancedUsage')">
<van-nav-bar :title="$t('title')" :left-text="$t('back')" left-arrow> <van-nav-bar
<van-icon name="search" slot="right" /> :title="$t('title')"
:left-text="$t('back')"
left-arrow
>
<van-icon
name="search"
slot="right"
/>
</van-nav-bar> </van-nav-bar>
</demo-block> </demo-block>
</demo-section> </demo-section>

View File

@ -4,18 +4,39 @@
:class="b({ fixed })" :class="b({ fixed })"
:style="style" :style="style"
> >
<div :class="b('left')" @click="$emit('click-left')"> <div
:class="b('left')"
@click="$emit('click-left')"
>
<slot name="left"> <slot name="left">
<icon v-if="leftArrow" :class="b('arrow')" name="arrow" /> <icon
<span v-if="leftText" v-text="leftText" :class="b('text')" /> v-if="leftArrow"
:class="b('arrow')"
name="arrow"
/>
<span
v-if="leftText"
v-text="leftText"
:class="b('text')"
/>
</slot> </slot>
</div> </div>
<div :class="b('title')" class="van-ellipsis"> <div
:class="b('title')"
class="van-ellipsis"
>
<slot name="title">{{ title }}</slot> <slot name="title">{{ title }}</slot>
</div> </div>
<div :class="b('right')" @click="$emit('click-right')"> <div
:class="b('right')"
@click="$emit('click-right')"
>
<slot name="right"> <slot name="right">
<span v-if="rightText" v-text="rightText" :class="b('text')" /> <span
v-if="rightText"
v-text="rightText"
:class="b('text')"
/>
</slot> </slot>
</div> </div>
</div> </div>

View File

@ -8,12 +8,21 @@
</demo-block> </demo-block>
<demo-block :title="$t('title2')"> <demo-block :title="$t('title2')">
<van-notice-bar :scrollable="false" :text="$t('text')" /> <van-notice-bar
:scrollable="false"
:text="$t('text')"
/>
</demo-block> </demo-block>
<demo-block :title="$t('title3')"> <demo-block :title="$t('title3')">
<van-notice-bar mode="closeable" :text="$t('text')" /> <van-notice-bar
<van-notice-bar mode="link" :text="$t('text')" /> mode="closeable"
:text="$t('text')"
/>
<van-notice-bar
mode="link"
:text="$t('text')"
/>
</demo-block> </demo-block>
</demo-section> </demo-section>
</template> </template>

View File

@ -5,10 +5,16 @@
:style="barStyle" :style="barStyle"
@click="$emit('click')" @click="$emit('click')"
> >
<div v-if="leftIcon" :class="b('left-icon')"> <div
v-if="leftIcon"
:class="b('left-icon')"
>
<img :src="leftIcon" > <img :src="leftIcon" >
</div> </div>
<div :class="b('wrap')" ref="wrap"> <div
ref="wrap"
:class="b('wrap')"
>
<div <div
ref="content" ref="content"
:class="[b('content'), animationClass, { 'van-ellipsis': !scrollable }]" :class="[b('content'), animationClass, { 'van-ellipsis': !scrollable }]"

View File

@ -8,7 +8,11 @@
@animationend="onAnimationEnd" @animationend="onAnimationEnd"
@webkitAnimationEnd="onAnimationEnd" @webkitAnimationEnd="onAnimationEnd"
> >
<div :class="b('title')" class="van-hairline--top" v-if="title || showTitleClose"> <div
v-if="title || showTitleClose"
:class="b('title')"
class="van-hairline--top"
>
<span v-text="title" /> <span v-text="title" />
<span <span
:class="b('close')" :class="b('close')"
@ -26,9 +30,20 @@
@press="onPressKey" @press="onPressKey"
/> />
</div> </div>
<div v-if="theme === 'custom'" :class="b('sidebar')"> <div
<key :text="deleteText" :type="['delete', 'big', 'gray']" @press="onPressKey" /> v-if="theme === 'custom'"
<key :text="closeButtonText" :type="['blue', 'big']" @press="onPressKey" /> :class="b('sidebar')"
>
<key
:text="deleteText"
:type="['delete', 'big', 'gray']"
@press="onPressKey"
/>
<key
:text="closeButtonText"
:type="['blue', 'big']"
@press="onPressKey"
/>
</div> </div>
</div> </div>
</transition> </transition>

View File

@ -8,7 +8,6 @@
{{ prevText || $t('prev') }} {{ prevText || $t('prev') }}
</li> </li>
<li <li
v-if="isMultiMode"
v-for="page in pages" v-for="page in pages"
class="van-hairline" class="van-hairline"
:class="[b('item', { active: page.active }), b('page')]" :class="[b('item', { active: page.active }), b('page')]"
@ -16,7 +15,10 @@
> >
{{ page.text }} {{ page.text }}
</li> </li>
<li v-if="!isMultiMode" :class="b('page-desc')"> <li
v-if="!isMultiMode"
:class="b('page-desc')"
>
<slot name="pageDesc">{{ pageDesc }}</slot> <slot name="pageDesc">{{ pageDesc }}</slot>
</li> </li>
<li <li
@ -77,6 +79,10 @@ export default create({
const pages = []; const pages = [];
const pageCount = this.computedPageCount; const pageCount = this.computedPageCount;
if (!this.isMultiMode) {
return pages;
}
// Default page limits // Default page limits
let startPage = 1; let startPage = 1;
let endPage = pageCount; let endPage = pageCount;

View File

@ -33,11 +33,6 @@ exports[`renders demo correctly 1`] = `
<li class="van-hairline van-pagination__item van-pagination__item--disabled van-pagination__prev"> <li class="van-hairline van-pagination__item van-pagination__item--disabled van-pagination__prev">
上一页 上一页
</li> </li>
<!---->
<!---->
<!---->
<!---->
<!---->
<li class="van-pagination__page-desc">1/12</li> <li class="van-pagination__page-desc">1/12</li>
<li class="van-hairline van-pagination__item van-pagination__next"> <li class="van-hairline van-pagination__item van-pagination__next">
下一页 下一页

View File

@ -1,17 +1,30 @@
<template> <template>
<demo-section> <demo-section>
<demo-block :title="$t('basicUsage')"> <demo-block :title="$t('basicUsage')">
<van-panel :title="$t('title')" :desc="$t('desc')" :status="$t('status')"> <van-panel
:title="$t('title')"
:desc="$t('desc')"
:status="$t('status')"
>
<div>{{ $t('content') }}</div> <div>{{ $t('content') }}</div>
</van-panel> </van-panel>
</demo-block> </demo-block>
<demo-block :title="$t('advancedUsage')"> <demo-block :title="$t('advancedUsage')">
<van-panel :title="$t('title')" :desc="$t('desc')" :status="$t('status')"> <van-panel
:title="$t('title')"
:desc="$t('desc')"
:status="$t('status')"
>
<div>{{ $t('content') }}</div> <div>{{ $t('content') }}</div>
<div slot="footer"> <div slot="footer">
<van-button size="small">{{ $t('button') }}</van-button> <van-button size="small">{{ $t('button') }}</van-button>
<van-button size="small" type="danger">{{ $t('button') }}</van-button> <van-button
size="small"
type="danger"
>
{{ $t('button') }}
</van-button>
</div> </div>
</van-panel> </van-panel>
</demo-block> </demo-block>

View File

@ -12,7 +12,11 @@
<div :class="b('content')"> <div :class="b('content')">
<slot /> <slot />
</div> </div>
<div v-if="$slots.footer" :class="b('footer')" class="van-hairline--top"> <div
v-if="$slots.footer"
:class="b('footer')"
class="van-hairline--top"
>
<slot name="footer" /> <slot name="footer" />
</div> </div>
</cell-group> </cell-group>

View File

@ -34,7 +34,9 @@ exports[`renders demo correctly 1`] = `
<div class="van-hairline--top van-panel__footer"> <div class="van-hairline--top van-panel__footer">
<div> <div>
<button class="van-button van-button--default van-button--small"><span class="van-button__text">按钮</span></button> <button class="van-button van-button--default van-button--small"><span class="van-button__text">按钮</span></button>
<button class="van-button van-button--danger van-button--small"><span class="van-button__text">按钮</span></button> <button class="van-button van-button--danger van-button--small"><span class="van-button__text">
按钮
</span></button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,7 +1,14 @@
<template> <template>
<div :class="b()"> <div :class="b()">
<ul :class="b('security')" class="van-hairline--surround" @touchstart.stop="$emit('focus')"> <ul
<li v-for="visibility in points" class="van-hairline"> :class="b('security')"
class="van-hairline--surround"
@touchstart.stop="$emit('focus')"
>
<li
v-for="visibility in points"
class="van-hairline"
>
<i :style="`visibility: ${visibility}`" /> <i :style="`visibility: ${visibility}`" />
</li> </li>
</ul> </ul>

View File

@ -1,7 +1,10 @@
<template> <template>
<demo-section> <demo-section>
<demo-block :title="$t('basicUsage')"> <demo-block :title="$t('basicUsage')">
<van-picker :columns="$t('column1')" @change="onChange1" /> <van-picker
:columns="$t('column1')"
@change="onChange1"
/>
</demo-block> </demo-block>
<demo-block :title="$t('title2')"> <demo-block :title="$t('title2')">
@ -19,11 +22,17 @@
</demo-block> </demo-block>
<demo-block :title="$t('title4')"> <demo-block :title="$t('title4')">
<van-picker :columns="columns" @change="onChange2" /> <van-picker
:columns="columns"
@change="onChange2"
/>
</demo-block> </demo-block>
<demo-block :title="$t('loading')"> <demo-block :title="$t('loading')">
<van-picker :columns="columns" loading /> <van-picker
loading
:columns="columns"
/>
</demo-block> </demo-block>
</demo-section> </demo-section>
</template> </template>

View File

@ -1,16 +1,42 @@
<template> <template>
<div :class="b()"> <div :class="b()">
<div :class="b('toolbar')" class="van-hairline--top-bottom" v-if="showToolbar"> <div
v-if="showToolbar"
:class="b('toolbar')"
class="van-hairline--top-bottom"
>
<slot> <slot>
<div :class="b('cancel')" @click="emit('cancel')">{{ cancelButtonText || $t('cancel') }}</div> <div
<div :class="b('title')" class="van-ellipsis" v-if="title" v-text="title" /> :class="b('cancel')"
<div :class="b('confirm')" @click="emit('confirm')">{{ confirmButtonText || $t('confirm') }}</div> @click="emit('cancel')"
>
{{ cancelButtonText || $t('cancel') }}
</div>
<div
v-if="title"
v-text="title"
:class="b('title')"
class="van-ellipsis"
/>
<div
:class="b('confirm')"
@click="emit('confirm')"
>
{{ confirmButtonText || $t('confirm') }}
</div>
</slot> </slot>
</div> </div>
<div v-if="loading" :class="b('loading')"> <div
v-if="loading"
:class="b('loading')"
>
<loading /> <loading />
</div> </div>
<div :class="b('columns')" :style="columnsStyle" @touchmove.prevent> <div
:class="b('columns')"
:style="columnsStyle"
@touchmove.prevent
>
<picker-column <picker-column
v-for="(item, index) in (simple ? [columns] : columns)" v-for="(item, index) in (simple ? [columns] : columns)"
:key="index" :key="index"
@ -22,7 +48,11 @@
:visible-item-count="visibleItemCount" :visible-item-count="visibleItemCount"
@change="onChange(index)" @change="onChange(index)"
/> />
<div :class="b('frame')" class="van-hairline--top-bottom" :style="frameStyle" /> <div
:class="b('frame')"
class="van-hairline--top-bottom"
:style="frameStyle"
/>
</div> </div>
</div> </div>
</template> </template>

View File

@ -39,9 +39,13 @@ exports[`renders demo correctly 1`] = `
<div> <div>
<div class="van-picker"> <div class="van-picker">
<div class="van-hairline--top-bottom van-picker__toolbar"> <div class="van-hairline--top-bottom van-picker__toolbar">
<div class="van-picker__cancel">取消</div> <div class="van-picker__cancel">
取消
</div>
<div class="van-ellipsis van-picker__title">标题</div> <div class="van-ellipsis van-picker__title">标题</div>
<div class="van-picker__confirm">确认</div> <div class="van-picker__confirm">
确认
</div>
</div> </div>
<!----> <!---->
<div class="van-picker__columns" style="height:220px;"> <div class="van-picker__columns" style="height:220px;">

View File

@ -8,7 +8,10 @@
<demo-block :title="$t('position')"> <demo-block :title="$t('position')">
<van-button @click="show2 = true;">{{ $t('button2') }}</van-button> <van-button @click="show2 = true;">{{ $t('button2') }}</van-button>
<van-popup v-model="show2" position="bottom"> <van-popup
v-model="show2"
position="bottom"
>
<van-picker <van-picker
show-toolbar show-toolbar
:columns="$t('columns')" :columns="$t('columns')"
@ -18,15 +21,25 @@
</van-popup> </van-popup>
<van-button @click="show3 = true">{{ $t('button4') }}</van-button> <van-button @click="show3 = true">{{ $t('button4') }}</van-button>
<van-popup v-model="show3" position="top" :overlay="false"> <van-popup
v-model="show3"
position="top"
:overlay="false"
>
{{ $t('content') }} {{ $t('content') }}
</van-popup> </van-popup>
<van-button @click="show4 = true">{{ $t('button5') }}</van-button> <van-button @click="show4 = true">{{ $t('button5') }}</van-button>
<van-popup v-model="show4" position="right"> <van-popup
v-model="show4"
position="right"
>
<van-button @click="show4 = false">{{ $t('button6') }}</van-button> <van-button @click="show4 = false">{{ $t('button6') }}</van-button>
<van-button @click="show5 = true">{{ $t('button5') }}</van-button> <van-button @click="show5 = true">{{ $t('button5') }}</van-button>
<van-popup v-model="show5" position="right"> <van-popup
v-model="show5"
position="right"
>
<van-button @click="show5 = false">{{ $t('button6') }}</van-button> <van-button @click="show5 = false">{{ $t('button6') }}</van-button>
</van-popup> </van-popup>
</van-popup> </van-popup>

View File

@ -1,6 +1,10 @@
<template> <template>
<transition :name="currentTransition"> <transition :name="currentTransition">
<div v-if="shouldRender" v-show="value" :class="b({ [position]: position })"> <div
v-if="shouldRender"
v-show="value"
:class="b({ [position]: position })"
>
<slot /> <slot />
</div> </div>
</transition> </transition>

View File

@ -5,12 +5,23 @@
</demo-block> </demo-block>
<demo-block :title="$t('title2')"> <demo-block :title="$t('title2')">
<van-progress inactive :percentage="50" /> <van-progress
inactive
:percentage="50"
/>
</demo-block> </demo-block>
<demo-block :title="$t('title3')"> <demo-block :title="$t('title3')">
<van-progress :pivot-text="$t('orange')" color="#f2826a" :percentage="25" /> <van-progress
<van-progress :pivot-text="$t('red')" color="#f44" :percentage="50" /> color="#f2826a"
:percentage="25"
:pivot-text="$t('orange')"
/>
<van-progress
color="#f44"
:percentage="50"
:pivot-text="$t('red')"
/>
<van-progress <van-progress
:percentage="75" :percentage="75"
:pivot-text="$t('purple')" :pivot-text="$t('purple')"

View File

@ -1,7 +1,17 @@
<template> <template>
<div :class="b()"> <div :class="b()">
<span :class="b('portion', { 'with-pivot': showPivot && text })" :style="portionStyle"> <span
<span v-if="showPivot && text" ref="pivot" :style="pivotStyle" :class="b('pivot')">{{ text }}</span> :class="b('portion', { 'with-pivot': showPivot && text })"
:style="portionStyle"
>
<span
v-if="showPivot && text"
ref="pivot"
:style="pivotStyle"
:class="b('pivot')"
>
{{ text }}
</span>
</span> </span>
</div> </div>
</template> </template>

View File

@ -3,19 +3,29 @@
exports[`renders demo correctly 1`] = ` exports[`renders demo correctly 1`] = `
<div> <div>
<div> <div>
<div class="van-progress"><span class="van-progress__portion van-progress__portion--with-pivot" style="width:0px;background:#1989fa;"><span class="van-progress__pivot" style="color:#fff;background:#1989fa;">50%</span></span> <div class="van-progress"><span class="van-progress__portion van-progress__portion--with-pivot" style="width:0px;background:#1989fa;"><span class="van-progress__pivot" style="color:#fff;background:#1989fa;">
50%
</span></span>
</div> </div>
</div> </div>
<div> <div>
<div class="van-progress"><span class="van-progress__portion van-progress__portion--with-pivot" style="width:0px;background:#cacaca;"><span class="van-progress__pivot" style="color:#fff;background:#cacaca;">50%</span></span> <div class="van-progress"><span class="van-progress__portion van-progress__portion--with-pivot" style="width:0px;background:#cacaca;"><span class="van-progress__pivot" style="color:#fff;background:#cacaca;">
50%
</span></span>
</div> </div>
</div> </div>
<div> <div>
<div class="van-progress"><span class="van-progress__portion van-progress__portion--with-pivot" style="width:0px;background:#f2826a;"><span class="van-progress__pivot" style="color:#fff;background:#f2826a;">橙色</span></span> <div class="van-progress"><span class="van-progress__portion van-progress__portion--with-pivot" style="width:0px;background:#f2826a;"><span class="van-progress__pivot" style="color:#fff;background:#f2826a;">
橙色
</span></span>
</div> </div>
<div class="van-progress"><span class="van-progress__portion van-progress__portion--with-pivot" style="width:0px;background:#f44;"><span class="van-progress__pivot" style="color:#fff;background:#f44;">红色</span></span> <div class="van-progress"><span class="van-progress__portion van-progress__portion--with-pivot" style="width:0px;background:#f44;"><span class="van-progress__pivot" style="color:#fff;background:#f44;">
红色
</span></span>
</div> </div>
<div class="van-progress"><span class="van-progress__portion van-progress__portion--with-pivot" style="width:0px;background:linear-gradient(to right, #be99ff, #7232dd);"><span class="van-progress__pivot" style="color:#fff;background:#7232dd;">紫色</span></span> <div class="van-progress"><span class="van-progress__portion van-progress__portion--with-pivot" style="width:0px;background:linear-gradient(to right, #be99ff, #7232dd);"><span class="van-progress__pivot" style="color:#fff;background:#7232dd;">
紫色
</span></span>
</div> </div>
</div> </div>
</div> </div>

View File

@ -3,6 +3,8 @@
exports[`calc width 1`] = `<div class="van-progress"><span class="van-progress__portion" style="width: 0px; background: rgb(25, 137, 250);"><!----></span></div>`; exports[`calc width 1`] = `<div class="van-progress"><span class="van-progress__portion" style="width: 0px; background: rgb(25, 137, 250);"><!----></span></div>`;
exports[`calc width 2`] = ` exports[`calc width 2`] = `
<div class="van-progress"><span class="van-progress__portion van-progress__portion--with-pivot" style="width: 0px; background: rgb(25, 137, 250);"><span class="van-progress__pivot" style="color: rgb(255, 255, 255); background: rgb(25, 137, 250);">test</span></span> <div class="van-progress"><span class="van-progress__portion van-progress__portion--with-pivot" style="width: 0px; background: rgb(25, 137, 250);"><span class="van-progress__pivot" style="color: rgb(255, 255, 255); background: rgb(25, 137, 250);">
test
</span></span>
</div> </div>
`; `;

View File

@ -1,6 +1,9 @@
<template> <template>
<demo-section name="pull-refresh"> <demo-section name="pull-refresh">
<van-pull-refresh v-model="isLoading" @refresh="onRefresh"> <van-pull-refresh
v-model="isLoading"
@refresh="onRefresh"
>
<demo-block :title="$t('basicUsage')"> <demo-block :title="$t('basicUsage')">
<p>{{ $t('text') }}: {{ count }}</p> <p>{{ $t('text') }}: {{ count }}</p>
</demo-block> </demo-block>

View File

@ -9,14 +9,26 @@
@touchcancel="onTouchEnd" @touchcancel="onTouchEnd"
> >
<div :class="b('head')"> <div :class="b('head')">
<slot v-if="status === 'normal'" name="normal" /> <slot
<slot v-if="status === 'pulling'" name="pulling"> v-if="status === 'normal'"
name="normal"
/>
<slot
v-if="status === 'pulling'"
name="pulling"
>
<span :class="b('text')">{{ pullingText || $t('pulling') }}</span> <span :class="b('text')">{{ pullingText || $t('pulling') }}</span>
</slot> </slot>
<slot v-if="status === 'loosing'" name="loosing"> <slot
v-if="status === 'loosing'"
name="loosing"
>
<span :class="b('text')">{{ loosingText || $t('loosing') }}</span> <span :class="b('text')">{{ loosingText || $t('loosing') }}</span>
</slot> </slot>
<slot v-if="status === 'loading'" name="loading"> <slot
v-if="status === 'loading'"
name="loading"
>
<div :class="b('loading')"> <div :class="b('loading')">
<loading /> <loading />
<span>{{ loadingText || $t('loadingTip') }}</span> <span>{{ loadingText || $t('loadingTip') }}</span>

View File

@ -1,14 +1,21 @@
<template> <template>
<demo-section> <demo-section>
<demo-block :title="$t('basicUsage')"> <demo-block :title="$t('basicUsage')">
<van-radio-group v-model="radio1" class="demo-radio-group"> <van-radio-group
v-model="radio1"
class="demo-radio-group"
>
<van-radio name="1">{{ $t('radio') }} 1</van-radio> <van-radio name="1">{{ $t('radio') }} 1</van-radio>
<van-radio name="2">{{ $t('radio') }} 2</van-radio> <van-radio name="2">{{ $t('radio') }} 2</van-radio>
</van-radio-group> </van-radio-group>
</demo-block> </demo-block>
<demo-block :title="$t('disabled')"> <demo-block :title="$t('disabled')">
<van-radio-group v-model="radio2" class="demo-radio-group" disabled> <van-radio-group
v-model="radio2"
class="demo-radio-group"
disabled
>
<van-radio name="1">{{ $t('radio') }} 1</van-radio> <van-radio name="1">{{ $t('radio') }} 1</van-radio>
<van-radio name="2">{{ $t('radio') }} 2</van-radio> <van-radio name="2">{{ $t('radio') }} 2</van-radio>
</van-radio-group> </van-radio-group>
@ -17,10 +24,18 @@
<demo-block :title="$t('title3')"> <demo-block :title="$t('title3')">
<van-radio-group v-model="radio3"> <van-radio-group v-model="radio3">
<van-cell-group> <van-cell-group>
<van-cell :title="$t('radio') + 1" clickable @click="radio3 = '1'"> <van-cell
:title="$t('radio') + 1"
clickable
@click="radio3 = '1'"
>
<van-radio name="1" /> <van-radio name="1" />
</van-cell> </van-cell>
<van-cell :title="$t('radio') + 2" clickable @click="radio3 = '2'"> <van-cell
:title="$t('radio') + 2"
clickable
@click="radio3 = '2'"
>
<van-radio name="2" /> <van-radio name="2" />
</van-cell> </van-cell>
</van-cell-group> </van-cell-group>

View File

@ -1,5 +1,8 @@
<template> <template>
<div :class="b({ disabled: isDisabled })" @click="$emit('click')"> <div
:class="b({ disabled: isDisabled })"
@click="$emit('click')"
>
<span :class="b('input')"> <span :class="b('input')">
<input <input
:value="name" :value="name"
@ -10,7 +13,11 @@
> >
<icon :name="currentValue === name ? 'checked' : 'check'" /> <icon :name="currentValue === name ? 'checked' : 'check'" />
</span> </span>
<span v-if="$slots.default" :class="b('label', labelPosition)" @click="onClickLabel"> <span
v-if="$slots.default"
:class="b('label', labelPosition)"
@click="onClickLabel"
>
<slot /> <slot />
</span> </span>
</div> </div>

View File

@ -15,7 +15,10 @@
</demo-block> </demo-block>
<demo-block :title="$t('disabled')"> <demo-block :title="$t('disabled')">
<van-rate disabled v-model="value3" /> <van-rate
v-model="value3"
disabled
/>
</demo-block> </demo-block>
</demo-section> </demo-section>
</template> </template>

View File

@ -1,5 +1,8 @@
<template> <template>
<div :class="b()" @touchmove="onTouchMove"> <div
:class="b()"
@touchmove="onTouchMove"
>
<svg <svg
v-for="(isFull, index) in list" v-for="(isFull, index) in list"
:fill="disabled ? disabledColor : isFull ? color : voidColor" :fill="disabled ? disabledColor : isFull ? color : voidColor"

View File

@ -26,7 +26,12 @@
show-action show-action
@search="onSearch" @search="onSearch"
> >
<div slot="action" @click="onSearch">{{ $t('search') }}</div> <div
slot="action"
@click="onSearch"
>
{{ $t('search') }}
</div>
</van-search> </van-search>
</demo-block> </demo-block>
</demo-section> </demo-section>

View File

@ -1,5 +1,8 @@
<template> <template>
<div :class="b({ 'show-action': showAction })" :style="{ background }"> <div
:class="b({ 'show-action': showAction })"
:style="{ background }"
>
<field <field
v-bind="$attrs" v-bind="$attrs"
v-on="listeners" v-on="listeners"
@ -9,9 +12,15 @@
:border="false" :border="false"
left-icon="search" left-icon="search"
> >
<slot name="left-icon" slot="left-icon" /> <slot
name="left-icon"
slot="left-icon"
/>
</field> </field>
<div v-if="showAction" :class="b('action')"> <div
v-if="showAction"
:class="b('action')"
>
<slot name="action"> <slot name="action">
<div @click="onBack">{{ $t('cancel') }}</div> <div @click="onBack">{{ $t('cancel') }}</div>
</slot> </slot>

View File

@ -67,7 +67,9 @@ exports[`renders demo correctly 1`] = `
<!----> <!---->
</div> </div>
<div class="van-search__action"> <div class="van-search__action">
<div>搜索</div> <div>
搜索
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -31,12 +31,26 @@
</slot> </slot>
</sku-header> </sku-header>
</slot> </slot>
<div class="van-sku-body" :style="bodyStyle"> <div
class="van-sku-body"
:style="bodyStyle"
>
<!-- sku-body-top --> <!-- sku-body-top -->
<slot name="sku-body-top" :selected-sku="selectedSku" :sku-event-bus="skuEventBus" /> <slot
name="sku-body-top"
:selected-sku="selectedSku"
:sku-event-bus="skuEventBus"
/>
<!-- sku-group --> <!-- sku-group -->
<slot name="sku-group" :selected-sku="selectedSku" :sku-event-bus="skuEventBus"> <slot
<div v-if="hasSku" class="van-sku-group-container van-hairline--bottom"> name="sku-group"
:selected-sku="selectedSku"
:sku-event-bus="skuEventBus"
>
<div
v-if="hasSku"
class="van-sku-group-container van-hairline--bottom"
>
<sku-row <sku-row
v-for="(skuTreeItem, index) in skuTree" v-for="(skuTreeItem, index) in skuTree"
:key="index" :key="index"
@ -55,7 +69,10 @@
</div> </div>
</slot> </slot>
<!-- extra-sku-group --> <!-- extra-sku-group -->
<slot name="extra-sku-group" :sku-event-bus="skuEventBus"/> <slot
name="extra-sku-group"
:sku-event-bus="skuEventBus"
/>
<!-- sku-stepper --> <!-- sku-stepper -->
<slot <slot
name="sku-stepper" name="sku-stepper"
@ -91,7 +108,10 @@
</slot> </slot>
</div> </div>
<!-- sku-actions --> <!-- sku-actions -->
<slot name="sku-actions" :sku-event-bus="skuEventBus"> <slot
name="sku-actions"
:sku-event-bus="skuEventBus"
>
<sku-actions <sku-actions
:sku-event-bus="skuEventBus" :sku-event-bus="skuEventBus"
:buy-text="buyText" :buy-text="buyText"

View File

@ -1,13 +1,23 @@
<template> <template>
<div :class="b()" class="van-hairline--bottom"> <div
<div :class="b('img-wrap')" @click="previewImage"> :class="b()"
class="van-hairline--bottom"
>
<div
:class="b('img-wrap')"
@click="previewImage"
>
<img :src="goodsImg" > <img :src="goodsImg" >
</div> </div>
<div :class="b('goods-info')"> <div :class="b('goods-info')">
<div class="van-sku__goods-name van-ellipsis">{{ goods.title }}</div> <div class="van-sku__goods-name van-ellipsis">{{ goods.title }}</div>
<!-- price display area --> <!-- price display area -->
<slot /> <slot />
<icon name="close" class="van-sku__close-icon" @click="skuEventBus.$emit('sku:close')" /> <icon
name="close"
class="van-sku__close-icon"
@click="skuEventBus.$emit('sku:close')"
/>
</div> </div>
</div> </div>
</template> </template>

View File

@ -18,19 +18,32 @@
</div> </div>
</van-uploader> </van-uploader>
<!-- 图片列表区域 --> <!-- 图片列表区域 -->
<div class="van-clearfix" v-if="paddingImg || imgList.length > 0"> <div
v-if="paddingImg || imgList.length > 0"
class="van-clearfix"
>
<!-- 已有的图片,图片右上角显示删除按钮 --> <!-- 已有的图片,图片右上角显示删除按钮 -->
<div <div
v-for="img in imgList" v-for="img in imgList"
:class="b('img')" :class="b('img')"
> >
<img :src="img"> <img :src="img">
<icon name="clear" :class="b('delete')" @click="$emit('input', '')" /> <icon
name="clear"
:class="b('delete')"
@click="$emit('input', '')"
/>
</div> </div>
<!-- 正在上传的图片,有上传等待提示 --> <!-- 正在上传的图片,有上传等待提示 -->
<div v-if="paddingImg" :class="b('img')"> <div
v-if="paddingImg"
:class="b('img')"
>
<img :src="paddingImg"> <img :src="paddingImg">
<loading :class="b('uploading')" type="spinner" /> <loading
type="spinner"
:class="b('uploading')"
/>
</div> </div>
</div> </div>
</div> </div>

View File

@ -12,8 +12,18 @@
@change="onChange" @change="onChange"
/> />
</div> </div>
<div v-if="!hideStock" class="van-sku__stock">{{ stockText }}</div> <div
<div v-if="quotaText" class="van-sku__quota">{{ quotaText }}</div> v-if="!hideStock"
class="van-sku__stock"
>
{{ stockText }}
</div>
<div
v-if="quotaText"
class="van-sku__quota"
>
{{ quotaText }}
</div>
</div> </div>
</template> </template>

View File

@ -19,7 +19,13 @@
@buy-clicked="onBuyClicked" @buy-clicked="onBuyClicked"
@add-cart="onAddCartClicked" @add-cart="onAddCartClicked"
/> />
<van-button type="primary" @click="showBase = true" block>{{ $t('basicUsage') }}</van-button> <van-button
block
type="primary"
@click="showBase = true"
>
{{ $t('basicUsage') }}
</van-button>
</div> </div>
</demo-block> </demo-block>
@ -38,7 +44,13 @@
@buy-clicked="onBuyClicked" @buy-clicked="onBuyClicked"
@add-cart="onAddCartClicked" @add-cart="onAddCartClicked"
/> />
<van-button type="primary" @click="showStepper = true" block>{{ $t('title2') }}</van-button> <van-button
block
type="primary"
@click="showStepper = true"
>
{{ $t('title2') }}
</van-button>
</div> </div>
</demo-block> </demo-block>
@ -60,19 +72,42 @@
@buy-clicked="onBuyClicked" @buy-clicked="onBuyClicked"
@add-cart="onAddCartClicked" @add-cart="onAddCartClicked"
> >
<template slot="sku-header-price" slot-scope="props"> <template
slot="sku-header-price"
slot-scope="props"
>
<div class="van-sku__goods-price"> <div class="van-sku__goods-price">
<span class="van-sku__price-symbol"></span><span class="van-sku__price-num">{{ props.price }}</span> <span class="van-sku__price-symbol"></span><span class="van-sku__price-num">{{ props.price }}</span>
</div> </div>
</template> </template>
<template slot="sku-actions" slot-scope="props"> <template
slot="sku-actions"
slot-scope="props"
>
<div class="van-sku-actions"> <div class="van-sku-actions">
<van-button bottom-action @click="onPointClicked">{{ $t('button1') }}</van-button> <van-button
<van-button type="primary" bottom-action @click="props.skuEventBus.$emit('sku:buy')">{{ $t('button2') }}</van-button> bottom-action
@click="onPointClicked"
>
{{ $t('button1') }}
</van-button>
<van-button
type="primary"
bottom-action
@click="props.skuEventBus.$emit('sku:buy')"
>
{{ $t('button2') }}
</van-button>
</div> </div>
</template> </template>
</van-sku> </van-sku>
<van-button type="primary" @click="showCustom = true" block>{{ $t('advancedUsage') }}</van-button> <van-button
block
type="primary"
@click="showCustom = true"
>
{{ $t('advancedUsage') }}
</van-button>
</div> </div>
</demo-block> </demo-block>
</demo-section> </demo-section>

View File

@ -5,19 +5,25 @@ exports[`renders demo correctly 1`] = `
<div> <div>
<div class="sku-container"> <div class="sku-container">
<!----> <!---->
<button class="van-button van-button--primary van-button--normal van-button--block"><span class="van-button__text">基础用法</span></button> <button class="van-button van-button--primary van-button--normal van-button--block"><span class="van-button__text">
基础用法
</span></button>
</div> </div>
</div> </div>
<div> <div>
<div class="sku-container"> <div class="sku-container">
<!----> <!---->
<button class="van-button van-button--primary van-button--normal van-button--block"><span class="van-button__text">自定义步进器相关配置</span></button> <button class="van-button van-button--primary van-button--normal van-button--block"><span class="van-button__text">
自定义步进器相关配置
</span></button>
</div> </div>
</div> </div>
<div> <div>
<div class="sku-container"> <div class="sku-container">
<!----> <!---->
<button class="van-button van-button--primary van-button--normal van-button--block"><span class="van-button__text">高级用法</span></button> <button class="van-button van-button--primary van-button--normal van-button--block"><span class="van-button__text">
高级用法
</span></button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,7 +1,10 @@
<template> <template>
<demo-section> <demo-section>
<demo-block :title="$t('title1')"> <demo-block :title="$t('title1')">
<van-slider v-model="value1" @change="onChange" /> <van-slider
v-model="value1"
@change="onChange"
/>
</demo-block> </demo-block>
<demo-block :title="$t('title2')"> <demo-block :title="$t('title2')">
@ -14,7 +17,10 @@
</demo-block> </demo-block>
<demo-block :title="$t('title3')"> <demo-block :title="$t('title3')">
<van-slider v-model="value3" disabled /> <van-slider
v-model="value3"
disabled
/>
</demo-block> </demo-block>
<demo-block :title="$t('title4')"> <demo-block :title="$t('title4')">

View File

@ -1,6 +1,12 @@
<template> <template>
<div :class="b({ disabled })" @click.stop="onClick"> <div
<div :class="b('bar')" :style="barStyle"> :class="b({ disabled })"
@click.stop="onClick"
>
<div
:class="b('bar')"
:style="barStyle"
>
<span <span
:class="b('button')" :class="b('button')"
@touchstart="onTouchStart" @touchstart="onTouchStart"

View File

@ -1,11 +1,24 @@
<template> <template>
<div class="van-hairline" :class="b([$parent.direction, { [status]: status }])"> <div
<div :class="b('title')" :style="titleStyle"> class="van-hairline"
:class="b([$parent.direction, { [status]: status }])"
>
<div
:class="b('title')"
:style="titleStyle"
>
<slot /> <slot />
</div> </div>
<div :class="b('circle-container')"> <div :class="b('circle-container')">
<i :class="b('circle')" v-if="status !== 'process'" /> <i
<icon v-else name="checked" :style="{ color: $parent.activeColor }" /> v-if="status !== 'process'"
:class="b('circle')"
/>
<icon
v-else
name="checked"
:style="{ color: $parent.activeColor }"
/>
</div> </div>
<div :class="b('line')" /> <div :class="b('line')" />
</div> </div>

Some files were not shown because too many files have changed in this diff Show More