1
0
mirror of https://gitee.com/vant-contrib/vant.git synced 2025-04-24 18:36:51 +08:00

[Doc] Demo: use v-slot shorthand ()

This commit is contained in:
neverland 2019-06-20 17:40:57 +08:00 committed by GitHub
parent d9f2ad6759
commit 5b12d80d97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 36 additions and 39 deletions
packages
card/demo
cell
demo
test/__snapshots__
checkbox/demo
collapse
demo
test/__snapshots__
field/demo
image-preview/demo
image/demo
nav-bar/demo
panel/demo
radio/demo
search/demo
sku/demo
slider/demo
submit-bar/demo
swipe-cell/demo
swipe/demo
tab/demo
tabbar/demo

@ -20,7 +20,7 @@
:title="$t('title')"
:thumb="imageURL"
>
<template v-slot:tags>
<template #tags>
<div class="card__tags">
<van-tag
plain
@ -37,7 +37,7 @@
</div>
</template>
<template v-slot:footer>
<template #footer>
<div class="card__footer">
<van-button
round

@ -92,7 +92,7 @@
icon="shop-o"
is-link
>
<template v-slot:title>
<template #title>
<span class="custom-text">{{ $t('cell') }}</span>
<van-tag type="danger">{{ $t('tag') }}</van-tag>
</template>
@ -103,11 +103,12 @@
is-link
/>
<van-cell :title="$t('cell')">
<van-icon
v-slot:right-icon
name="search"
class="custom-icon"
/>
<template #right-icon>
<van-icon
name="search"
class="custom-icon"
/>
</template>
</van-cell>
</demo-block>
</demo-section>

@ -99,9 +99,8 @@ exports[`renders demo correctly 1`] = `
<!----></i>
</div>
<div class="van-cell">
<div class="van-cell__title"><span>单元格</span></div>
<div class="van-cell__value"><i class="custom-icon van-icon van-icon-search">
<!----></i></div>
<div class="van-cell__title"><span>单元格</span></div><i class="custom-icon van-icon van-icon-search">
<!----></i>
</div>
</div>
</div>

@ -31,7 +31,7 @@
<demo-block :title="$t('customIcon')">
<van-checkbox v-model="checkbox3">
{{ $t('customIcon') }}
<template v-slot:icon="{ checked }">
<template #icon="{ checked }">
<img :src="checked ? icon.active : icon.inactive">
</template>
</van-checkbox>

@ -27,8 +27,8 @@
<demo-block :title="$t('titleSlot')">
<van-collapse v-model="active3">
<van-collapse-item>
<template v-slot:title>
<div>{{ $t('title') + 1 }}<van-icon name="question-o" /></div>
<template #title>
{{ $t('title') + 1 }}<van-icon name="question-o" />
</template>
{{ $t('text') }}
</van-collapse-item>

@ -57,9 +57,8 @@ exports[`renders demo correctly 1`] = `
<div class="van-collapse-item">
<div role="button" tabindex="0" aria-expanded="false" class="van-cell van-cell--clickable van-collapse-item__title">
<div class="van-cell__title">
<div>标题1<i class="van-icon van-icon-question-o">
<!----></i></div>
</div><i class="van-icon van-icon-arrow van-cell__right-icon">
标题1<i class="van-icon van-icon-question-o">
<!----></i></div><i class="van-icon van-icon-arrow van-cell__right-icon">
<!----></i>
</div>
</div>

@ -81,7 +81,7 @@
:label="$t('sms')"
:placeholder="$t('smsPlaceholder')"
>
<template v-slot:button>
<template #button>
<van-button
size="small"
type="primary"

@ -39,7 +39,7 @@
:images="images"
@change="onChange"
>
<template v-slot:index>{{ $t('index', index) }}</template>
<template #index>{{ $t('index', index) }}</template>
</van-image-preview>
</demo-block>
</demo-section>

@ -43,7 +43,7 @@
width="100%"
height="27vw"
>
<template v-slot:loading>
<template #loading>
<van-loading
type="spinner"
size="20"
@ -72,9 +72,7 @@
height="27vw"
src="x"
>
<template v-slot:error>
{{ $t('loadFail') }}
</template>
<template #error>{{ $t('loadFail') }}</template>
</van-image>
<div class="text">{{ $t('customTip') }}</div>
</van-col>

@ -17,7 +17,7 @@
:left-text="$t('back')"
left-arrow
>
<template v-slot:right>
<template #right>
<van-icon name="search" />
</template>
</van-nav-bar>

@ -17,7 +17,7 @@
:status="$t('status')"
>
<div>{{ $t('content') }}</div>
<template v-slot:footer>
<template #footer>
<van-button size="small">{{ $t('button') }}</van-button>
<van-button
size="small"

@ -48,13 +48,13 @@
>
<van-radio name="1">
{{ $t('radio') }} 1
<template v-slot:icon="{ checked }">
<template #icon="{ checked }">
<img :src="checked ? icon.active : icon.inactive">
</template>
</van-radio>
<van-radio name="2">
{{ $t('radio') }} 2
<template v-slot:icon="{ checked }">
<template #icon="{ checked }">
<img :src="checked ? icon.active : icon.inactive">
</template>
</van-radio>

@ -28,7 +28,7 @@
:label="$t('label')"
@search="onSearch"
>
<template v-slot:action>
<template #action>
<div @click="onSearch">{{ $t('search') }}</div>
</template>
</van-search>

@ -103,12 +103,12 @@
@buy-clicked="onBuyClicked"
@add-cart="onAddCartClicked"
>
<template v-slot:sku-header-price="{ price }">
<template #sku-header-price="{ price }">
<div class="van-sku__goods-price">
<span class="van-sku__price-symbol"></span><span class="van-sku__price-num">{{ price }}</span>
</div>
</template>
<template v-slot:sku-actions="{ skuEventBus }">
<template #sku-actions="{ skuEventBus }">
<div class="van-sku-actions">
<van-button
square

@ -45,7 +45,7 @@
v-model="value6"
active-color="#f44"
>
<template v-slot:button>
<template #button>
<div class="custom-button">{{ value6 }}</div>
</template>
</van-slider>

@ -35,7 +35,7 @@
@submit="onClickButton"
>
<van-checkbox v-model="checked">{{ $t('check') }}</van-checkbox>
<template v-slot:tip>
<template #tip>
{{ $t('tip2') }}
<span
class="edit-address"

@ -4,7 +4,7 @@
<van-notice-bar>{{ $t('tips') }}</van-notice-bar>
<demo-block :title="$t('basicUsage')">
<van-swipe-cell>
<template v-slot:left>
<template #left>
<van-button
square
type="danger"
@ -16,7 +16,7 @@
:title="$t('title')"
:value="$t('content')"
/>
<template v-slot:right>
<template #right>
<van-button
square
type="danger"
@ -28,7 +28,7 @@
<demo-block :title="$t('title2')">
<van-swipe-cell :on-close="onClose">
<template v-slot:left>
<template #left>
<van-button
square
type="danger"
@ -40,7 +40,7 @@
:title="$t('title')"
:value="$t('content')"
/>
<template v-slot:right>
<template #right>
<van-button
square
type="danger"

@ -70,7 +70,7 @@
<van-swipe-item>3</van-swipe-item>
<van-swipe-item>4</van-swipe-item>
<template v-slot:indicator>
<template #indicator>
<div class="custom-indicator">{{ current + 1 }}/4</div>
</template>
</van-swipe>

@ -82,7 +82,7 @@
v-for="index in 2"
:key="index"
>
<template v-slot:title>
<template #title>
<van-icon name="more-o" />{{ $t('tab') }}
</template>
{{ $t('content') }} {{ index }}

@ -66,7 +66,7 @@
<van-tabbar v-model="active3">
<van-tabbar-item info="3">
<span>{{ $t('custom') }}</span>
<template v-slot:icon="{ active }">
<template #icon="{ active }">
<img :src="active ? icon.active : icon.normal">
</template>
</van-tabbar-item>