docs: fix cdn link (#8023)

This commit is contained in:
neverland
2021-01-27 10:25:07 +08:00
committed by GitHub
parent 07678f2d6b
commit 67d44a0fa5
93 changed files with 267 additions and 250 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ app.use(Button);
```html
<van-button icon="plus" type="primary" />
<van-button icon="plus" type="primary">Button</van-button>
<van-button icon="https://img.yzcdn.cn/vant/user-active.png" type="primary">
<van-button icon="https://img01.yzcdn.cn/vant/user-active.png" type="primary">
Button
</van-button>
```
+1 -1
View File
@@ -81,7 +81,7 @@ app.use(Button);
```html
<van-button icon="plus" type="primary" />
<van-button icon="plus" type="primary">按钮</van-button>
<van-button icon="https://img.yzcdn.cn/vant/user-active.png" type="primary">
<van-button icon="https://img01.yzcdn.cn/vant/user-active.png" type="primary">
按钮
</van-button>
```
+1 -1
View File
@@ -41,7 +41,7 @@
<van-button
plain
type="primary"
icon="https://img.yzcdn.cn/vant/user-active.png"
icon="https://img01.yzcdn.cn/vant/user-active.png"
:text="t('button')"
/>
</demo-block>
@@ -243,7 +243,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-button__content">
<i class="van-badge__wrapper van-icon van-button__icon">
<img class="van-icon__image"
src="https://img.yzcdn.cn/vant/user-active.png"
src="https://img01.yzcdn.cn/vant/user-active.png"
>
</i>
<span class="van-button__text">
+3 -3
View File
@@ -20,7 +20,7 @@ app.use(Card);
price="2.00"
title="Title"
desc="Description"
thumb="https://img.yzcdn.cn/vant/ipad.jpeg"
thumb="https://img01.yzcdn.cn/vant/ipad.jpeg"
/>
```
@@ -34,7 +34,7 @@ app.use(Card);
title="Title"
desc="Description"
origin-price="10.00"
thumb="https://img.yzcdn.cn/vant/ipad.jpeg"
thumb="https://img01.yzcdn.cn/vant/ipad.jpeg"
/>
```
@@ -48,7 +48,7 @@ Use slot to custom content.
title="Title"
desc="Description"
price="2.00"
thumb="https://img.yzcdn.cn/vant/ipad.jpeg"
thumb="https://img01.yzcdn.cn/vant/ipad.jpeg"
>
<template #tags>
<van-tag plain type="danger">Tag</van-tag>
+3 -3
View File
@@ -24,7 +24,7 @@ app.use(Card);
price="2.00"
desc="描述信息"
title="商品标题"
thumb="https://img.yzcdn.cn/vant/ipad.jpeg"
thumb="https://img01.yzcdn.cn/vant/ipad.jpeg"
/>
```
@@ -39,7 +39,7 @@ app.use(Card);
price="2.00"
desc="描述信息"
title="商品标题"
thumb="https://img.yzcdn.cn/vant/ipad.jpeg"
thumb="https://img01.yzcdn.cn/vant/ipad.jpeg"
origin-price="10.00"
/>
```
@@ -54,7 +54,7 @@ app.use(Card);
price="2.00"
desc="描述信息"
title="商品标题"
thumb="https://img.yzcdn.cn/vant/ipad.jpeg"
thumb="https://img01.yzcdn.cn/vant/ipad.jpeg"
>
<template #tags>
<van-tag plain type="danger">标签</van-tag>
+1 -1
View File
@@ -73,7 +73,7 @@ export default {
return {
t,
imageURL: 'https://img.yzcdn.cn/vant/ipad.jpeg',
imageURL: 'https://img01.yzcdn.cn/vant/ipad.jpeg',
};
},
};
@@ -8,7 +8,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-image"
style="width: 100%; height: 100%;"
>
<img src="https://img.yzcdn.cn/vant/ipad.jpeg"
<img src="https://img01.yzcdn.cn/vant/ipad.jpeg"
class="van-image__img"
style="object-fit: cover;"
>
@@ -57,7 +57,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-image"
style="width: 100%; height: 100%;"
>
<img src="https://img.yzcdn.cn/vant/ipad.jpeg"
<img src="https://img01.yzcdn.cn/vant/ipad.jpeg"
class="van-image__img"
style="object-fit: cover;"
>
@@ -116,7 +116,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-image"
style="width: 100%; height: 100%;"
>
<img src="https://img.yzcdn.cn/vant/ipad.jpeg"
<img src="https://img01.yzcdn.cn/vant/ipad.jpeg"
class="van-image__img"
style="object-fit: cover;"
>
+2 -2
View File
@@ -83,8 +83,8 @@ export default {
const checked = ref(true);
return {
checked,
activeIcon: 'https://img.yzcdn.cn/vant/user-active.png',
inactiveIcon: 'https://img.yzcdn.cn/vant/user-inactive.png',
activeIcon: 'https://img01.yzcdn.cn/vant/user-active.png',
inactiveIcon: 'https://img01.yzcdn.cn/vant/user-inactive.png',
};
},
};
+2 -2
View File
@@ -95,8 +95,8 @@ export default {
const checked = ref(true);
return {
checked,
activeIcon: 'https://img.yzcdn.cn/vant/user-active.png',
inactiveIcon: 'https://img.yzcdn.cn/vant/user-inactive.png',
activeIcon: 'https://img01.yzcdn.cn/vant/user-active.png',
inactiveIcon: 'https://img01.yzcdn.cn/vant/user-inactive.png',
};
},
};
+2 -2
View File
@@ -182,8 +182,8 @@ export default {
setRefs,
checkAll,
toggleAll,
activeIcon: 'https://img.yzcdn.cn/vant/user-active.png',
inactiveIcon: 'https://img.yzcdn.cn/vant/user-inactive.png',
activeIcon: 'https://img01.yzcdn.cn/vant/user-active.png',
inactiveIcon: 'https://img01.yzcdn.cn/vant/user-inactive.png',
};
},
};
@@ -100,7 +100,7 @@ exports[`should render demo and match snapshot 1`] = `
aria-checked="true"
>
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--checked">
<img src="https://img.yzcdn.cn/vant/user-active.png">
<img src="https://img01.yzcdn.cn/vant/user-active.png">
</div>
<span class="van-checkbox__label">
Custom Icon
+1 -1
View File
@@ -111,7 +111,7 @@ export default {
| close-button-text | Close button text | _string_ | `Close` |
| input-placeholder | Input placeholder | _string_ | `Coupon code` |
| currency | Currency symbol | _string_ | `¥` |
| empty-image | Placeholder image when list is empty | _string_ | `https://img.yzcdn.cn/vant/coupon-empty.png` |
| empty-image | Placeholder image when list is empty | _string_ | `https://img01.yzcdn.cn/vant/coupon-empty.png` |
| show-count | Whether to show coupon count in tab title | _boolean_ | `true` |
### CouponList Events
+1 -1
View File
@@ -113,7 +113,7 @@ export default {
| input-placeholder | 输入框文字提示 | _string_ | `请输入优惠码` |
| show-exchange-bar | 是否展示兑换栏 | _boolean_ | `true` |
| currency | 货币符号 | _string_ | `¥` |
| empty-image | 列表为空时的占位图 | _string_ | `https://img.yzcdn.cn/vant/coupon-empty.png` |
| empty-image | 列表为空时的占位图 | _string_ | `https://img01.yzcdn.cn/vant/coupon-empty.png` |
| show-count | 是否展示可用 / 不可用数量 | _boolean_ | `true` |
### CouponList Events
@@ -235,14 +235,14 @@ exports[`render empty coupon list 1`] = `
<div class="van-tabs__content">
<div role="tabpanel" class="van-tab__pane" style="display: none;">
<div class="van-coupon-list__list van-coupon-list__list--with-bottom" style="height: 628px;">
<div class="van-coupon-list__empty"><img src="https://img.yzcdn.cn/vant/coupon-empty.png">
<div class="van-coupon-list__empty"><img src="https://img01.yzcdn.cn/vant/coupon-empty.png">
<p>暂无优惠券</p>
</div>
</div>
</div>
<div role="tabpanel" class="van-tab__pane" style="">
<div class="van-coupon-list__list van-coupon-list__list--with-bottom" style="height: 628px;">
<div class="van-coupon-list__empty"><img src="https://img.yzcdn.cn/vant/coupon-empty.png">
<div class="van-coupon-list__empty"><img src="https://img01.yzcdn.cn/vant/coupon-empty.png">
<p>暂无优惠券</p>
</div>
</div>
+1 -1
View File
@@ -106,7 +106,7 @@ If you need to render vue components within a dialog, you can use dialog compone
```html
<van-dialog v-model:show="show" title="Title" show-cancel-button>
<img src="https://img.yzcdn.cn/vant/apple-3.jpg" />
<img src="https://img01.yzcdn.cn/vant/apple-3.jpg" />
</van-dialog>
```
+1 -1
View File
@@ -139,7 +139,7 @@ export default {
```html
<van-dialog v-model:show="show" title="标题" show-cancel-button>
<img src="https://img.yzcdn.cn/vant/apple-3.jpg" />
<img src="https://img01.yzcdn.cn/vant/apple-3.jpg" />
</van-dialog>
```
+1 -1
View File
@@ -108,7 +108,7 @@ export default {
return {
t,
show,
image: 'https://img.yzcdn.cn/vant/apple-3.jpg',
image: 'https://img01.yzcdn.cn/vant/apple-3.jpg',
onClickAlert,
onClickAlert2,
onClickRound,
@@ -104,7 +104,7 @@ exports[`should render demo and match snapshot 1`] = `
Title
</div>
<div class="van-dialog__content">
<img src="https://img.yzcdn.cn/vant/apple-3.jpg">
<img src="https://img01.yzcdn.cn/vant/apple-3.jpg">
</div>
<div class="van-hairline--top van-dialog__footer">
<button type="button"
+1 -1
View File
@@ -36,7 +36,7 @@ Use the image prop to display different placeholder images.
```html
<van-empty
class="custom-image"
image="https://img.yzcdn.cn/vant/leaf.jpg"
image="https://img01.yzcdn.cn/vant/leaf.jpg"
description="Description"
/>
+1 -1
View File
@@ -42,7 +42,7 @@ Empty 组件内置了多种占位图片类型,可以在不同业务场景下
```html
<van-empty
class="custom-image"
image="https://img.yzcdn.cn/vant/custom-empty-image.png"
image="https://img01.yzcdn.cn/vant/custom-empty-image.png"
description="描述文字"
/>
+1 -1
View File
@@ -20,7 +20,7 @@
<demo-block :title="t('customImage')">
<van-empty
class="custom-image"
image="https://img.yzcdn.cn/vant/custom-empty-image.png"
image="https://img01.yzcdn.cn/vant/custom-empty-image.png"
:description="t('description')"
/>
</demo-block>
@@ -79,7 +79,7 @@ exports[`should render demo and match snapshot 1`] = `
<div>
<div class="van-empty custom-image">
<div class="van-empty__image">
<img src="https://img.yzcdn.cn/vant/custom-empty-image.png">
<img src="https://img01.yzcdn.cn/vant/custom-empty-image.png">
</div>
<p class="van-empty__description">
Description
+1 -1
View File
@@ -286,7 +286,7 @@ import { ref } from 'vue';
export default {
setup() {
const value = ref([{ url: 'https://img.yzcdn.cn/vant/leaf.jpg' }]);
const value = ref([{ url: 'https://img01.yzcdn.cn/vant/leaf.jpg' }]);
return { value };
},
};
+1 -1
View File
@@ -311,7 +311,7 @@ import { ref } from 'vue';
export default {
setup() {
const value = ref([{ url: 'https://img.yzcdn.cn/vant/leaf.jpg' }]);
const value = ref([{ url: 'https://img01.yzcdn.cn/vant/leaf.jpg' }]);
return { value };
},
};
+1 -1
View File
@@ -127,7 +127,7 @@ export default {
radio: '1',
slider: 50,
stepper: 1,
uploader: [{ url: 'https://img.yzcdn.cn/vant/leaf.jpg' }],
uploader: [{ url: 'https://img01.yzcdn.cn/vant/leaf.jpg' }],
checkbox: false,
checkboxGroup: [],
switchChecked: false,
@@ -393,7 +393,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-uploader__wrapper">
<div class="van-uploader__preview">
<div class="van-image van-uploader__preview-image">
<img src="https://img.yzcdn.cn/vant/leaf.jpg"
<img src="https://img01.yzcdn.cn/vant/leaf.jpg"
class="van-image__img"
style="object-fit: cover;"
>
+3 -3
View File
@@ -37,13 +37,13 @@ app.use(GridItem);
```html
<van-grid :border="false" :column-num="3">
<van-grid-item>
<van-image src="https://img.yzcdn.cn/vant/apple-1.jpg" />
<van-image src="https://img01.yzcdn.cn/vant/apple-1.jpg" />
</van-grid-item>
<van-grid-item>
<van-image src="https://img.yzcdn.cn/vant/apple-2.jpg" />
<van-image src="https://img01.yzcdn.cn/vant/apple-2.jpg" />
</van-grid-item>
<van-grid-item>
<van-image src="https://img.yzcdn.cn/vant/apple-3.jpg" />
<van-image src="https://img01.yzcdn.cn/vant/apple-3.jpg" />
</van-grid-item>
</van-grid>
```
+3 -3
View File
@@ -47,13 +47,13 @@ app.use(GridItem);
```html
<van-grid :border="false" :column-num="3">
<van-grid-item>
<van-image src="https://img.yzcdn.cn/vant/apple-1.jpg" />
<van-image src="https://img01.yzcdn.cn/vant/apple-1.jpg" />
</van-grid-item>
<van-grid-item>
<van-image src="https://img.yzcdn.cn/vant/apple-2.jpg" />
<van-image src="https://img01.yzcdn.cn/vant/apple-2.jpg" />
</van-grid-item>
<van-grid-item>
<van-image src="https://img.yzcdn.cn/vant/apple-3.jpg" />
<van-image src="https://img01.yzcdn.cn/vant/apple-3.jpg" />
</van-grid-item>
</van-grid>
```
+12 -3
View File
@@ -14,13 +14,22 @@
<demo-block :title="t('customContent')">
<van-grid :border="false" :column-num="3">
<van-grid-item>
<van-image fit="contain" src="https://img.yzcdn.cn/vant/apple-1.jpg" />
<van-image
fit="contain"
src="https://img01.yzcdn.cn/vant/apple-1.jpg"
/>
</van-grid-item>
<van-grid-item>
<van-image fit="contain" src="https://img.yzcdn.cn/vant/apple-2.jpg" />
<van-image
fit="contain"
src="https://img01.yzcdn.cn/vant/apple-2.jpg"
/>
</van-grid-item>
<van-grid-item>
<van-image fit="contain" src="https://img.yzcdn.cn/vant/apple-3.jpg" />
<van-image
fit="contain"
src="https://img01.yzcdn.cn/vant/apple-3.jpg"
/>
</van-grid-item>
</van-grid>
</demo-block>
@@ -126,7 +126,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<div class="van-grid-item__content van-grid-item__content--center">
<div class="van-image">
<img src="https://img.yzcdn.cn/vant/apple-1.jpg"
<img src="https://img01.yzcdn.cn/vant/apple-1.jpg"
class="van-image__img"
style="object-fit: contain;"
>
@@ -142,7 +142,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<div class="van-grid-item__content van-grid-item__content--center">
<div class="van-image">
<img src="https://img.yzcdn.cn/vant/apple-2.jpg"
<img src="https://img01.yzcdn.cn/vant/apple-2.jpg"
class="van-image__img"
style="object-fit: contain;"
>
@@ -158,7 +158,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<div class="van-grid-item__content van-grid-item__content--center">
<div class="van-image">
<img src="https://img.yzcdn.cn/vant/apple-3.jpg"
<img src="https://img01.yzcdn.cn/vant/apple-3.jpg"
class="van-image__img"
style="object-fit: contain;"
>
+12 -12
View File
@@ -16,8 +16,8 @@ app.use(ImagePreview);
```js
ImagePreview([
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',
'https://img01.yzcdn.cn/vant/apple-1.jpg',
'https://img01.yzcdn.cn/vant/apple-2.jpg',
]);
```
@@ -26,8 +26,8 @@ ImagePreview([
```js
ImagePreview({
images: [
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',
'https://img01.yzcdn.cn/vant/apple-1.jpg',
'https://img01.yzcdn.cn/vant/apple-2.jpg',
],
startPosition: 1,
});
@@ -40,8 +40,8 @@ After setting the `closeable` attribute, the close icon will be displayed in the
```js
ImagePreview({
images: [
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',
'https://img01.yzcdn.cn/vant/apple-1.jpg',
'https://img01.yzcdn.cn/vant/apple-2.jpg',
],
closeable: true,
});
@@ -54,8 +54,8 @@ import { Toast } from 'vant';
ImagePreview({
images: [
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',
'https://img01.yzcdn.cn/vant/apple-1.jpg',
'https://img01.yzcdn.cn/vant/apple-2.jpg',
],
onClose() {
Toast('closed');
@@ -68,8 +68,8 @@ ImagePreview({
```js
const instance = ImagePreview({
images: [
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',
'https://img01.yzcdn.cn/vant/apple-1.jpg',
'https://img01.yzcdn.cn/vant/apple-2.jpg',
],
beforeClose: () => false,
});
@@ -107,8 +107,8 @@ export default {
return {
state,
images: [
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',
'https://img01.yzcdn.cn/vant/apple-1.jpg',
'https://img01.yzcdn.cn/vant/apple-2.jpg',
],
onChange,
};
+13 -13
View File
@@ -11,7 +11,7 @@ ImagePreview 是一个函数,调用函数后会直接在页面中展示图片
```js
import { ImagePreview } from 'vant';
ImagePreview(['https://img.yzcdn.cn/vant/apple-1.jpg']);
ImagePreview(['https://img01.yzcdn.cn/vant/apple-1.jpg']);
```
### 组件调用
@@ -42,8 +42,8 @@ export default {
```js
ImagePreview([
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',
'https://img01.yzcdn.cn/vant/apple-1.jpg',
'https://img01.yzcdn.cn/vant/apple-2.jpg',
]);
```
@@ -54,8 +54,8 @@ ImagePreview 支持传入配置对象,并通过 `startPosition` 选项指定
```js
ImagePreview({
images: [
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',
'https://img01.yzcdn.cn/vant/apple-1.jpg',
'https://img01.yzcdn.cn/vant/apple-2.jpg',
],
startPosition: 1,
});
@@ -68,8 +68,8 @@ ImagePreview({
```js
ImagePreview({
images: [
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',
'https://img01.yzcdn.cn/vant/apple-1.jpg',
'https://img01.yzcdn.cn/vant/apple-2.jpg',
],
closeable: true,
});
@@ -84,8 +84,8 @@ import { Toast } from 'vant';
ImagePreview({
images: [
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',
'https://img01.yzcdn.cn/vant/apple-1.jpg',
'https://img01.yzcdn.cn/vant/apple-2.jpg',
],
onClose() {
Toast('关闭');
@@ -100,8 +100,8 @@ ImagePreview({
```js
const instance = ImagePreview({
images: [
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',
'https://img01.yzcdn.cn/vant/apple-1.jpg',
'https://img01.yzcdn.cn/vant/apple-2.jpg',
],
beforeClose: () => false,
});
@@ -142,8 +142,8 @@ export default {
return {
state,
images: [
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',
'https://img01.yzcdn.cn/vant/apple-1.jpg',
'https://img01.yzcdn.cn/vant/apple-2.jpg',
],
onChange,
};
+4 -4
View File
@@ -65,10 +65,10 @@ const i18n = {
};
const images = [
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',
'https://img.yzcdn.cn/vant/apple-3.jpg',
'https://img.yzcdn.cn/vant/apple-4.jpg',
'https://img01.yzcdn.cn/vant/apple-1.jpg',
'https://img01.yzcdn.cn/vant/apple-2.jpg',
'https://img01.yzcdn.cn/vant/apple-3.jpg',
'https://img01.yzcdn.cn/vant/apple-4.jpg',
];
export default {
@@ -61,11 +61,11 @@ exports[`set show-index prop to false 1`] = `
`;
exports[`zoom in and drag image to move 1`] = `
<div class="van-image van-image-preview__image" style="transition-duration: 0s; transform: scale(2, 2) translate(0px, 0px);"><img src="https://img.yzcdn.cn/1.png" class="van-image__img" style="object-fit: contain;">
<div class="van-image van-image-preview__image" style="transition-duration: 0s; transform: scale(2, 2) translate(0px, 0px);"><img src="https://img01.yzcdn.cn/1.png" class="van-image__img" style="object-fit: contain;">
<div class="van-image__loading">
<div class="van-loading van-loading--spinner"><span class="van-loading__spinner van-loading__spinner--spinner"><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i></span></div>
</div>
</div>
`;
exports[`zoom in and drag image to move 2`] = `<div class="van-image van-image-preview__image" style="transition-duration: 0s; transform: scale(2, 2) translate(25px, 25px);"><img src="https://img.yzcdn.cn/1.png" class="van-image__img" style="object-fit: contain;"></div>`;
exports[`zoom in and drag image to move 2`] = `<div class="van-image van-image-preview__image" style="transition-duration: 0s; transform: scale(2, 2) translate(25px, 25px);"><img src="https://img01.yzcdn.cn/1.png" class="van-image__img" style="object-fit: contain;"></div>`;
+4 -4
View File
@@ -32,9 +32,9 @@ function triggerZoom(el, x, y, direction = 'in') {
}
const images = [
'https://img.yzcdn.cn/1.png',
'https://img.yzcdn.cn/2.png',
'https://img.yzcdn.cn/3.png',
'https://img01.yzcdn.cn/1.png',
'https://img01.yzcdn.cn/2.png',
'https://img01.yzcdn.cn/3.png',
];
test('render image', async () => {
@@ -139,7 +139,7 @@ test('onClose option', () => {
expect(onClose).toHaveBeenCalledTimes(1);
expect(onClose).toHaveBeenCalledWith({
index: 0,
url: 'https://img.yzcdn.cn/1.png',
url: 'https://img01.yzcdn.cn/1.png',
});
});
+3 -3
View File
@@ -4,9 +4,9 @@ import { later } from '../../../test';
import { trigger } from '../../utils';
const images = [
'https://img.yzcdn.cn/1.png',
'https://img.yzcdn.cn/2.png',
'https://img.yzcdn.cn/3.png',
'https://img01.yzcdn.cn/1.png',
'https://img01.yzcdn.cn/2.png',
'https://img01.yzcdn.cn/3.png',
];
test('should swipe to currect index after calling the swipeTo method', async () => {
+8 -4
View File
@@ -15,7 +15,11 @@ app.use(VanImage);
### Basic Usage
```html
<van-image width="100" height="100" src="https://img.yzcdn.cn/vant/cat.jpeg" />
<van-image
width="100"
height="100"
src="https://img01.yzcdn.cn/vant/cat.jpeg"
/>
```
### Fit Mode
@@ -25,7 +29,7 @@ app.use(VanImage);
width="10rem"
height="10rem"
fit="contain"
src="https://img.yzcdn.cn/vant/cat.jpeg"
src="https://img01.yzcdn.cn/vant/cat.jpeg"
/>
```
@@ -38,7 +42,7 @@ Show round image, it may not works at `fit=contain` and `fit=scale-down`.
round
width="10rem"
height="10rem"
src="https://img.yzcdn.cn/vant/cat.jpeg"
src="https://img01.yzcdn.cn/vant/cat.jpeg"
/>
```
@@ -49,7 +53,7 @@ Show round image, it may not works at `fit=contain` and `fit=scale-down`.
width="100"
height="100"
lazy-load
src="https://img.yzcdn.cn/vant/cat.jpeg"
src="https://img01.yzcdn.cn/vant/cat.jpeg"
/>
```
+10 -6
View File
@@ -21,7 +21,11 @@ app.use(VanImage);
基础用法与原生 `img` 标签一致,可以设置 `src``width``height``alt` 等原生属性。
```html
<van-image width="100" height="100" src="https://img.yzcdn.cn/vant/cat.jpeg" />
<van-image
width="100"
height="100"
src="https://img01.yzcdn.cn/vant/cat.jpeg"
/>
```
### 填充模式
@@ -33,7 +37,7 @@ app.use(VanImage);
width="10rem"
height="10rem"
fit="contain"
src="https://img.yzcdn.cn/vant/cat.jpeg"
src="https://img01.yzcdn.cn/vant/cat.jpeg"
/>
```
@@ -46,7 +50,7 @@ app.use(VanImage);
round
width="10rem"
height="10rem"
src="https://img.yzcdn.cn/vant/cat.jpeg"
src="https://img01.yzcdn.cn/vant/cat.jpeg"
/>
```
@@ -59,7 +63,7 @@ app.use(VanImage);
width="100"
height="100"
lazy-load
src="https://img.yzcdn.cn/vant/cat.jpeg"
src="https://img01.yzcdn.cn/vant/cat.jpeg"
/>
```
@@ -76,7 +80,7 @@ app.use(Lazyload);
`Image` 组件提供了默认的加载中提示,支持通过 `loading` 插槽自定义内容。
```html
<van-image src="https://img.yzcdn.cn/vant/cat.jpeg">
<van-image src="https://img01.yzcdn.cn/vant/cat.jpeg">
<template v-slot:loading>
<van-loading type="spinner" size="20" />
</template>
@@ -88,7 +92,7 @@ app.use(Lazyload);
`Image` 组件提供了默认的加载失败提示,支持通过 `error` 插槽自定义内容。
```html
<van-image src="https://img.yzcdn.cn/vant/cat.jpeg">
<van-image src="https://img01.yzcdn.cn/vant/cat.jpeg">
<template v-slot:error>加载失败</template>
</van-image>
```
+1 -1
View File
@@ -88,7 +88,7 @@ export default {
return {
t,
image: 'https://img.yzcdn.cn/vant/cat.jpeg',
image: 'https://img01.yzcdn.cn/vant/cat.jpeg',
fits: ['contain', 'cover', 'fill', 'none', 'scale-down'],
};
},
+11 -11
View File
@@ -6,7 +6,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-image"
style="width: 100px; height: 100px;"
>
<img src="https://img.yzcdn.cn/vant/cat.jpeg"
<img src="https://img01.yzcdn.cn/vant/cat.jpeg"
class="van-image__img"
>
<div class="van-image__loading">
@@ -24,7 +24,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-image"
style="width: 100%; height: 27vw;"
>
<img src="https://img.yzcdn.cn/vant/cat.jpeg"
<img src="https://img01.yzcdn.cn/vant/cat.jpeg"
class="van-image__img"
style="object-fit: contain;"
>
@@ -43,7 +43,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-image"
style="width: 100%; height: 27vw;"
>
<img src="https://img.yzcdn.cn/vant/cat.jpeg"
<img src="https://img01.yzcdn.cn/vant/cat.jpeg"
class="van-image__img"
style="object-fit: cover;"
>
@@ -62,7 +62,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-image"
style="width: 100%; height: 27vw;"
>
<img src="https://img.yzcdn.cn/vant/cat.jpeg"
<img src="https://img01.yzcdn.cn/vant/cat.jpeg"
class="van-image__img"
style="object-fit: fill;"
>
@@ -81,7 +81,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-image"
style="width: 100%; height: 27vw;"
>
<img src="https://img.yzcdn.cn/vant/cat.jpeg"
<img src="https://img01.yzcdn.cn/vant/cat.jpeg"
class="van-image__img"
style="object-fit: none;"
>
@@ -100,7 +100,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-image"
style="width: 100%; height: 27vw;"
>
<img src="https://img.yzcdn.cn/vant/cat.jpeg"
<img src="https://img01.yzcdn.cn/vant/cat.jpeg"
class="van-image__img"
style="object-fit: scale-down;"
>
@@ -123,7 +123,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-image van-image--round"
style="width: 100%; height: 27vw;"
>
<img src="https://img.yzcdn.cn/vant/cat.jpeg"
<img src="https://img01.yzcdn.cn/vant/cat.jpeg"
class="van-image__img"
style="object-fit: contain;"
>
@@ -142,7 +142,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-image van-image--round"
style="width: 100%; height: 27vw;"
>
<img src="https://img.yzcdn.cn/vant/cat.jpeg"
<img src="https://img01.yzcdn.cn/vant/cat.jpeg"
class="van-image__img"
style="object-fit: cover;"
>
@@ -161,7 +161,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-image van-image--round"
style="width: 100%; height: 27vw;"
>
<img src="https://img.yzcdn.cn/vant/cat.jpeg"
<img src="https://img01.yzcdn.cn/vant/cat.jpeg"
class="van-image__img"
style="object-fit: fill;"
>
@@ -180,7 +180,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-image van-image--round"
style="width: 100%; height: 27vw;"
>
<img src="https://img.yzcdn.cn/vant/cat.jpeg"
<img src="https://img01.yzcdn.cn/vant/cat.jpeg"
class="van-image__img"
style="object-fit: none;"
>
@@ -199,7 +199,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-image van-image--round"
style="width: 100%; height: 27vw;"
>
<img src="https://img.yzcdn.cn/vant/cat.jpeg"
<img src="https://img01.yzcdn.cn/vant/cat.jpeg"
class="van-image__img"
style="object-fit: scale-down;"
>
+2 -2
View File
@@ -28,8 +28,8 @@ export default {
setup() {
return {
imageList: [
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',
'https://img01.yzcdn.cn/vant/apple-1.jpg',
'https://img01.yzcdn.cn/vant/apple-2.jpg',
],
};
},
+2 -2
View File
@@ -32,8 +32,8 @@ export default {
setup() {
return {
imageList: [
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',
'https://img01.yzcdn.cn/vant/apple-1.jpg',
'https://img01.yzcdn.cn/vant/apple-2.jpg',
],
};
},
+8 -8
View File
@@ -39,18 +39,18 @@ export default {
return {
t,
imageList: [
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',
'https://img.yzcdn.cn/vant/apple-3.jpg',
'https://img.yzcdn.cn/vant/apple-4.jpg',
'https://img01.yzcdn.cn/vant/apple-1.jpg',
'https://img01.yzcdn.cn/vant/apple-2.jpg',
'https://img01.yzcdn.cn/vant/apple-3.jpg',
'https://img01.yzcdn.cn/vant/apple-4.jpg',
],
backgroundImageList: [
'https://img.yzcdn.cn/vant/apple-5.jpg',
'https://img.yzcdn.cn/vant/apple-6.jpg',
'https://img01.yzcdn.cn/vant/apple-5.jpg',
'https://img01.yzcdn.cn/vant/apple-6.jpg',
],
componentImageList: [
'https://img.yzcdn.cn/vant/apple-8.jpg',
'https://img.yzcdn.cn/vant/apple-7.jpg',
'https://img01.yzcdn.cn/vant/apple-8.jpg',
'https://img01.yzcdn.cn/vant/apple-7.jpg',
],
};
},
+3 -3
View File
@@ -71,17 +71,17 @@ Use slots to custom tips.
<template #pulling="props">
<img
class="doge"
src="https://img.yzcdn.cn/vant/doge.png"
src="https://img01.yzcdn.cn/vant/doge.png"
:style="{ transform: `scale(${props.distance / 80})` }"
/>
</template>
<template #loosing>
<img class="doge" src="https://img.yzcdn.cn/vant/doge.png" />
<img class="doge" src="https://img01.yzcdn.cn/vant/doge.png" />
</template>
<template #loading>
<img class="doge" src="https://img.yzcdn.cn/vant/doge-fire.jpg" />
<img class="doge" src="https://img01.yzcdn.cn/vant/doge-fire.jpg" />
</template>
<p>Refresh Count: {{ count }}</p>
</van-pull-refresh>
+3 -3
View File
@@ -76,19 +76,19 @@ export default {
<template #pulling="props">
<img
class="doge"
src="https://img.yzcdn.cn/vant/doge.png"
src="https://img01.yzcdn.cn/vant/doge.png"
:style="{ transform: `scale(${props.distance / 80})` }"
/>
</template>
<!-- 释放提示 -->
<template #loosing>
<img class="doge" src="https://img.yzcdn.cn/vant/doge.png" />
<img class="doge" src="https://img01.yzcdn.cn/vant/doge.png" />
</template>
<!-- 加载提示 -->
<template #loading>
<img class="doge" src="https://img.yzcdn.cn/vant/doge-fire.jpg" />
<img class="doge" src="https://img01.yzcdn.cn/vant/doge-fire.jpg" />
</template>
<p>刷新次数: {{ count }}</p>
</van-pull-refresh>
+2 -2
View File
@@ -115,8 +115,8 @@ export default {
const checked = ref('1');
return {
checked,
activeIcon: 'https://img.yzcdn.cn/vant/user-active.png',
inactiveIcon: 'https://img.yzcdn.cn/vant/user-inactive.png',
activeIcon: 'https://img01.yzcdn.cn/vant/user-active.png',
inactiveIcon: 'https://img01.yzcdn.cn/vant/user-inactive.png',
};
},
};
+2 -2
View File
@@ -129,8 +129,8 @@ export default {
const checked = ref('1');
return {
checked,
activeIcon: 'https://img.yzcdn.cn/vant/user-active.png',
inactiveIcon: 'https://img.yzcdn.cn/vant/user-inactive.png',
activeIcon: 'https://img01.yzcdn.cn/vant/user-active.png',
inactiveIcon: 'https://img01.yzcdn.cn/vant/user-inactive.png',
};
},
};
+2 -2
View File
@@ -140,8 +140,8 @@ export default {
return {
...toRefs(state),
t,
activeIcon: 'https://img.yzcdn.cn/vant/user-active.png',
inactiveIcon: 'https://img.yzcdn.cn/vant/user-inactive.png',
activeIcon: 'https://img01.yzcdn.cn/vant/user-active.png',
inactiveIcon: 'https://img01.yzcdn.cn/vant/user-inactive.png',
};
},
};
@@ -209,7 +209,7 @@ exports[`should render demo and match snapshot 1`] = `
aria-checked="true"
>
<div class="van-radio__icon van-radio__icon--round van-radio__icon--checked">
<img src="https://img.yzcdn.cn/vant/user-active.png">
<img src="https://img01.yzcdn.cn/vant/user-active.png">
</div>
<span class="van-radio__label">
Radio 1
@@ -221,7 +221,7 @@ exports[`should render demo and match snapshot 1`] = `
aria-checked="false"
>
<div class="van-radio__icon van-radio__icon--round">
<img src="https://img.yzcdn.cn/vant/user-inactive.png">
<img src="https://img01.yzcdn.cn/vant/user-inactive.png">
</div>
<span class="van-radio__label">
Radio 2
+3 -3
View File
@@ -103,15 +103,15 @@ export default {
const options = [
{
name: 'Name',
icon: 'https://img.yzcdn.cn/vant/custom-icon-fire.png',
icon: 'https://img01.yzcdn.cn/vant/custom-icon-fire.png',
},
{
name: 'Name',
icon: 'https://img.yzcdn.cn/vant/custom-icon-light.png',
icon: 'https://img01.yzcdn.cn/vant/custom-icon-light.png',
},
{
name: 'Name',
icon: 'https://img.yzcdn.cn/vant/custom-icon-water.png',
icon: 'https://img01.yzcdn.cn/vant/custom-icon-water.png',
},
];
+3 -3
View File
@@ -117,15 +117,15 @@ export default {
const options = [
{
name: '名称',
icon: 'https://img.yzcdn.cn/vant/custom-icon-fire.png',
icon: 'https://img01.yzcdn.cn/vant/custom-icon-fire.png',
},
{
name: '名称',
icon: 'https://img.yzcdn.cn/vant/custom-icon-light.png',
icon: 'https://img01.yzcdn.cn/vant/custom-icon-light.png',
},
{
name: '名称',
icon: 'https://img.yzcdn.cn/vant/custom-icon-water.png',
icon: 'https://img01.yzcdn.cn/vant/custom-icon-water.png',
},
];
+3 -3
View File
@@ -118,15 +118,15 @@ export default {
const customIconOptions = computed(() => [
{
name: t('name'),
icon: 'https://img.yzcdn.cn/vant/custom-icon-fire.png',
icon: 'https://img01.yzcdn.cn/vant/custom-icon-fire.png',
},
{
name: t('name'),
icon: 'https://img.yzcdn.cn/vant/custom-icon-light.png',
icon: 'https://img01.yzcdn.cn/vant/custom-icon-light.png',
},
{
name: t('name'),
icon: 'https://img.yzcdn.cn/vant/custom-icon-water.png',
icon: 'https://img01.yzcdn.cn/vant/custom-icon-water.png',
},
]);
+1 -1
View File
@@ -11,7 +11,7 @@
<van-switch v-model="show" size="24px" />
<van-skeleton title avatar :row="3" :loading="!show">
<div class="demo-preview">
<img src="https://img.yzcdn.cn/vant/logo.png" />
<img src="https://img01.yzcdn.cn/vant/logo.png" />
<div class="demo-content">
<h3>{{ t('title') }}</h3>
<p>{{ t('desc') }}</p>
+1 -1
View File
@@ -37,7 +37,7 @@ app.use(SwipeCell);
desc="Description"
title="Title"
class="goods-card"
thumb="https://img.yzcdn.cn/vant/cat.jpeg"
thumb="https://img01.yzcdn.cn/vant/cat.jpeg"
/>
<template #right>
<van-button square text="Delete" type="danger" class="delete-button" />
+1 -1
View File
@@ -45,7 +45,7 @@ app.use(SwipeCell);
desc="描述信息"
title="商品标题"
class="goods-card"
thumb="https://img.yzcdn.cn/vant/cat.jpeg"
thumb="https://img01.yzcdn.cn/vant/cat.jpeg"
/>
<template #right>
<van-button square text="删除" type="danger" class="delete-button" />
+1 -1
View File
@@ -92,7 +92,7 @@ export default {
return {
t,
imageURL: 'https://img.yzcdn.cn/vant/ipad.jpeg',
imageURL: 'https://img01.yzcdn.cn/vant/ipad.jpeg',
beforeClose,
};
},
@@ -63,7 +63,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-image"
style="width: 100%; height: 100%;"
>
<img src="https://img.yzcdn.cn/vant/ipad.jpeg"
<img src="https://img01.yzcdn.cn/vant/ipad.jpeg"
class="van-image__img"
style="object-fit: cover;"
>
+2 -2
View File
@@ -52,8 +52,8 @@ Use `lazy-render` prop to enable lazy rendering.
export default {
setup() {
const images = [
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',
'https://img01.yzcdn.cn/vant/apple-1.jpg',
'https://img01.yzcdn.cn/vant/apple-2.jpg',
];
return { images };
},
+2 -2
View File
@@ -56,8 +56,8 @@ app.use(SwipeItem);
export default {
setup() {
const images = [
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',
'https://img01.yzcdn.cn/vant/apple-1.jpg',
'https://img01.yzcdn.cn/vant/apple-2.jpg',
];
return { images };
},
+4 -4
View File
@@ -92,10 +92,10 @@ export default {
const t = useTranslate(i18n);
const current = ref(0);
const images = [
'https://img.yzcdn.cn/vant/apple-1.jpg',
'https://img.yzcdn.cn/vant/apple-2.jpg',
'https://img.yzcdn.cn/vant/apple-3.jpg',
'https://img.yzcdn.cn/vant/apple-4.jpg',
'https://img01.yzcdn.cn/vant/apple-1.jpg',
'https://img01.yzcdn.cn/vant/apple-2.jpg',
'https://img01.yzcdn.cn/vant/apple-3.jpg',
'https://img01.yzcdn.cn/vant/apple-4.jpg',
];
const onChange1 = (index) => Toast(t('message') + index);
@@ -49,12 +49,12 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-swipe-item"
style="width: 100px;"
>
<img src="https://img.yzcdn.cn/vant/apple-1.jpg">
<img src="https://img01.yzcdn.cn/vant/apple-1.jpg">
</div>
<div class="van-swipe-item"
style="width: 100px;"
>
<img src="https://img.yzcdn.cn/vant/apple-2.jpg">
<img src="https://img01.yzcdn.cn/vant/apple-2.jpg">
</div>
<div class="van-swipe-item"
style="width: 100px;"
@@ -63,7 +63,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-swipe-item"
style="width: 100px;"
>
<img src="https://img.yzcdn.cn/vant/apple-4.jpg">
<img src="https://img01.yzcdn.cn/vant/apple-4.jpg">
</div>
</div>
<div class="van-swipe__indicators">
+2 -2
View File
@@ -92,8 +92,8 @@ export default {
setup() {
const active = ref(0);
const icon = {
active: 'https://img.yzcdn.cn/vant/user-active.png',
inactive: 'https://img.yzcdn.cn/vant/user-inactive.png',
active: 'https://img01.yzcdn.cn/vant/user-active.png',
inactive: 'https://img01.yzcdn.cn/vant/user-inactive.png',
};
return {
icon,
+2 -2
View File
@@ -98,8 +98,8 @@ export default {
setup() {
const active = ref(0);
const icon = {
active: 'https://img.yzcdn.cn/vant/user-active.png',
inactive: 'https://img.yzcdn.cn/vant/user-inactive.png',
active: 'https://img01.yzcdn.cn/vant/user-active.png',
inactive: 'https://img01.yzcdn.cn/vant/user-inactive.png',
};
return {
icon,
+2 -2
View File
@@ -112,8 +112,8 @@ export default {
...toRefs(state),
t,
icon: {
active: 'https://img.yzcdn.cn/vant/user-active.png',
inactive: 'https://img.yzcdn.cn/vant/user-inactive.png',
active: 'https://img01.yzcdn.cn/vant/user-active.png',
inactive: 'https://img01.yzcdn.cn/vant/user-inactive.png',
},
onChange,
};
@@ -133,7 +133,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-tabbar van-tabbar--fixed van-hairline--top-bottom">
<div class="van-tabbar-item van-tabbar-item--active">
<div class="van-badge__wrapper van-tabbar-item__icon">
<img src="https://img.yzcdn.cn/vant/user-active.png">
<img src="https://img01.yzcdn.cn/vant/user-active.png">
<div class="van-badge van-badge--fixed">
3
</div>
+1 -1
View File
@@ -44,7 +44,7 @@ Toast({
Toast({
message: 'Custom Image',
icon: 'https://img.yzcdn.cn/vant/logo.png',
icon: 'https://img01.yzcdn.cn/vant/logo.png',
});
Toast.loading({
+1 -1
View File
@@ -54,7 +54,7 @@ Toast({
Toast({
message: '自定义图片',
icon: 'https://img.yzcdn.cn/vant/logo.png',
icon: 'https://img01.yzcdn.cn/vant/logo.png',
});
Toast.loading({
+1 -1
View File
@@ -117,7 +117,7 @@ export default {
const showImageToast = () => {
Toast({
message: t('customImage'),
icon: 'https://img.yzcdn.cn/vant/logo.png',
icon: 'https://img01.yzcdn.cn/vant/logo.png',
});
};
+2 -2
View File
@@ -111,11 +111,11 @@ export default {
<template #content>
<van-image
v-if="activeIndex === 0"
src="https://img.yzcdn.cn/vant/apple-1.jpg"
src="https://img01.yzcdn.cn/vant/apple-1.jpg"
/>
<van-image
v-if="activeIndex === 1"
src="https://img.yzcdn.cn/vant/apple-2.jpg"
src="https://img01.yzcdn.cn/vant/apple-2.jpg"
/>
</template>
</van-tree-select>
+2 -2
View File
@@ -117,11 +117,11 @@ export default {
<template #content>
<van-image
v-if="activeIndex === 0"
src="https://img.yzcdn.cn/vant/apple-1.jpg"
src="https://img01.yzcdn.cn/vant/apple-1.jpg"
/>
<van-image
v-if="activeIndex === 1"
src="https://img.yzcdn.cn/vant/apple-2.jpg"
src="https://img01.yzcdn.cn/vant/apple-2.jpg"
/>
</template>
</van-tree-select>
+2 -2
View File
@@ -25,12 +25,12 @@
<van-image
v-if="activeIndex3 === 0"
:show-loading="false"
src="https://img.yzcdn.cn/vant/apple-1.jpg"
src="https://img01.yzcdn.cn/vant/apple-1.jpg"
/>
<van-image
v-if="activeIndex3 === 1"
:show-loading="false"
src="https://img.yzcdn.cn/vant/apple-2.jpg"
src="https://img01.yzcdn.cn/vant/apple-2.jpg"
/>
</template>
</van-tree-select>
@@ -99,7 +99,7 @@ exports[`should render demo and match snapshot 1`] = `
</div>
<div class="van-tree-select__content">
<div class="van-image">
<img src="https://img.yzcdn.cn/vant/apple-1.jpg"
<img src="https://img01.yzcdn.cn/vant/apple-1.jpg"
class="van-image__img"
>
</div>
+6 -6
View File
@@ -44,7 +44,7 @@ import { ref } from 'vue';
export default {
setup() {
const fileList = ref([
{ url: 'https://img.yzcdn.cn/vant/leaf.jpg' },
{ url: 'https://img01.yzcdn.cn/vant/leaf.jpg' },
{ url: 'https://cloud-image', isImage: true },
]);
@@ -68,12 +68,12 @@ export default {
setup() {
const fileList = ref([
{
url: 'https://img.yzcdn.cn/vant/leaf.jpg',
url: 'https://img01.yzcdn.cn/vant/leaf.jpg',
status: 'uploading',
message: 'Uploading...',
},
{
url: 'https://img.yzcdn.cn/vant/tree.jpg',
url: 'https://img01.yzcdn.cn/vant/tree.jpg',
status: 'failed',
message: 'Failed',
},
@@ -236,16 +236,16 @@ import { Toast } from 'vant';
export default {
setup() {
const fileList = ref([
{ url: 'https://img.yzcdn.cn/vant/leaf.jpg' },
{ url: 'https://img01.yzcdn.cn/vant/leaf.jpg' },
{
url: 'https://img.yzcdn.cn/vant/sand.jpg',
url: 'https://img01.yzcdn.cn/vant/sand.jpg',
deletable: true,
beforeDelete: () => {
Toast('Customize the events and styles of a single preview image');
},
},
{
url: 'https://img.yzcdn.cn/vant/tree.jpg',
url: 'https://img01.yzcdn.cn/vant/tree.jpg',
deletable: true,
imageFit: 'contain',
previewSize: 120,
+6 -6
View File
@@ -53,7 +53,7 @@ import { ref } from 'vue';
export default {
setup() {
const fileList = ref([
{ url: 'https://img.yzcdn.cn/vant/leaf.jpg' },
{ url: 'https://img01.yzcdn.cn/vant/leaf.jpg' },
// Uploader 根据文件后缀来判断是否为图片文件
// 如果图片 URL 中不包含类型信息,可以添加 isImage 标记来声明
{ url: 'https://cloud-image', isImage: true },
@@ -81,12 +81,12 @@ export default {
setup() {
const fileList = ref([
{
url: 'https://img.yzcdn.cn/vant/leaf.jpg',
url: 'https://img01.yzcdn.cn/vant/leaf.jpg',
status: 'uploading',
message: '上传中...',
},
{
url: 'https://img.yzcdn.cn/vant/tree.jpg',
url: 'https://img01.yzcdn.cn/vant/tree.jpg',
status: 'failed',
message: '上传失败',
},
@@ -261,16 +261,16 @@ import { Toast } from 'vant';
export default {
setup() {
const fileList = ref([
{ url: 'https://img.yzcdn.cn/vant/leaf.jpg' },
{ url: 'https://img01.yzcdn.cn/vant/leaf.jpg' },
{
url: 'https://img.yzcdn.cn/vant/sand.jpg',
url: 'https://img01.yzcdn.cn/vant/sand.jpg',
deletable: true,
beforeDelete: () => {
Toast('自定义单个预览图片的事件和样式');
},
},
{
url: 'https://img.yzcdn.cn/vant/tree.jpg',
url: 'https://img01.yzcdn.cn/vant/tree.jpg',
deletable: true,
imageFit: 'contain',
previewSize: 120,
+10 -10
View File
@@ -102,23 +102,23 @@ export default {
const t = useTranslate(i18n);
const state = reactive({
fileList: [
{ url: 'https://img.yzcdn.cn/vant/leaf.jpg' },
{ url: 'https://img.yzcdn.cn/vant/tree.jpg' },
{ url: 'https://img01.yzcdn.cn/vant/leaf.jpg' },
{ url: 'https://img01.yzcdn.cn/vant/tree.jpg' },
],
fileList2: [{ url: 'https://img.yzcdn.cn/vant/sand.jpg' }],
fileList2: [{ url: 'https://img01.yzcdn.cn/vant/sand.jpg' }],
fileList3: [],
fileList4: [{ url: 'https://img.yzcdn.cn/vant/sand.jpg' }],
fileList4: [{ url: 'https://img01.yzcdn.cn/vant/sand.jpg' }],
fileList5: [
{ url: 'https://img.yzcdn.cn/vant/leaf.jpg' },
{ url: 'https://img01.yzcdn.cn/vant/leaf.jpg' },
{
url: 'https://img.yzcdn.cn/vant/sand.jpg',
url: 'https://img01.yzcdn.cn/vant/sand.jpg',
deletable: true,
beforeDelete: () => {
Toast(t('deleteMessage'));
},
},
{
url: 'https://img.yzcdn.cn/vant/tree.jpg',
url: 'https://img01.yzcdn.cn/vant/tree.jpg',
deletable: true,
imageFit: 'contain',
previewSize: 120,
@@ -126,19 +126,19 @@ export default {
],
statusFileList: [
{
url: 'https://img.yzcdn.cn/vant/leaf.jpg',
url: 'https://img01.yzcdn.cn/vant/leaf.jpg',
status: 'uploading',
message: t('uploading'),
},
{
url: 'https://img.yzcdn.cn/vant/tree.jpg',
url: 'https://img01.yzcdn.cn/vant/tree.jpg',
status: 'failed',
message: t('failed'),
},
],
previewCoverFiles: [
{
url: 'https://img.yzcdn.cn/vant/leaf.jpg',
url: 'https://img01.yzcdn.cn/vant/leaf.jpg',
file: {
name: t('imageName'),
},
@@ -20,7 +20,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-uploader__wrapper">
<div class="van-uploader__preview">
<div class="van-image van-uploader__preview-image">
<img src="https://img.yzcdn.cn/vant/leaf.jpg"
<img src="https://img01.yzcdn.cn/vant/leaf.jpg"
class="van-image__img"
style="object-fit: cover;"
>
@@ -36,7 +36,7 @@ exports[`should render demo and match snapshot 1`] = `
</div>
<div class="van-uploader__preview">
<div class="van-image van-uploader__preview-image">
<img src="https://img.yzcdn.cn/vant/tree.jpg"
<img src="https://img01.yzcdn.cn/vant/tree.jpg"
class="van-image__img"
style="object-fit: cover;"
>
@@ -67,7 +67,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-uploader__wrapper">
<div class="van-uploader__preview">
<div class="van-image van-uploader__preview-image">
<img src="https://img.yzcdn.cn/vant/leaf.jpg"
<img src="https://img01.yzcdn.cn/vant/leaf.jpg"
class="van-image__img"
style="object-fit: cover;"
>
@@ -98,7 +98,7 @@ exports[`should render demo and match snapshot 1`] = `
</div>
<div class="van-uploader__preview">
<div class="van-image van-uploader__preview-image">
<img src="https://img.yzcdn.cn/vant/tree.jpg"
<img src="https://img01.yzcdn.cn/vant/tree.jpg"
class="van-image__img"
style="object-fit: cover;"
>
@@ -135,7 +135,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-uploader__wrapper">
<div class="van-uploader__preview">
<div class="van-image van-uploader__preview-image">
<img src="https://img.yzcdn.cn/vant/sand.jpg"
<img src="https://img01.yzcdn.cn/vant/sand.jpg"
class="van-image__img"
style="object-fit: cover;"
>
@@ -166,7 +166,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-uploader__wrapper">
<div class="van-uploader__preview">
<div class="van-image van-uploader__preview-image">
<img src="https://img.yzcdn.cn/vant/sand.jpg"
<img src="https://img01.yzcdn.cn/vant/sand.jpg"
class="van-image__img"
style="object-fit: cover;"
>
@@ -220,7 +220,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-uploader__wrapper">
<div class="van-uploader__preview">
<div class="van-image van-uploader__preview-image">
<img src="https://img.yzcdn.cn/vant/leaf.jpg"
<img src="https://img01.yzcdn.cn/vant/leaf.jpg"
class="van-image__img"
style="object-fit: cover;"
>
@@ -284,7 +284,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-uploader__wrapper">
<div class="van-uploader__preview">
<div class="van-image van-uploader__preview-image">
<img src="https://img.yzcdn.cn/vant/leaf.jpg"
<img src="https://img01.yzcdn.cn/vant/leaf.jpg"
class="van-image__img"
style="object-fit: cover;"
>
@@ -296,7 +296,7 @@ exports[`should render demo and match snapshot 1`] = `
</div>
<div class="van-uploader__preview">
<div class="van-image van-uploader__preview-image">
<img src="https://img.yzcdn.cn/vant/sand.jpg"
<img src="https://img01.yzcdn.cn/vant/sand.jpg"
class="van-image__img"
style="object-fit: cover;"
>
@@ -314,7 +314,7 @@ exports[`should render demo and match snapshot 1`] = `
<div class="van-image van-uploader__preview-image"
style="width: 120px; height: 120px;"
>
<img src="https://img.yzcdn.cn/vant/tree.jpg"
<img src="https://img01.yzcdn.cn/vant/tree.jpg"
class="van-image__img"
style="object-fit: contain;"
>
@@ -41,7 +41,7 @@ exports[`image-fit prop 1`] = `
<div class="van-uploader">
<div class="van-uploader__wrapper">
<div class="van-uploader__preview">
<div class="van-image van-uploader__preview-image"><img src="https://img.yzcdn.cn/vant/cat.jpeg" class="van-image__img" style="object-fit: contain;">
<div class="van-image van-uploader__preview-image"><img src="https://img01.yzcdn.cn/vant/cat.jpeg" class="van-image__img" style="object-fit: contain;">
<div class="van-image__loading"><i class="van-icon van-icon-photo van-image__loading-icon">
<!----></i></div>
</div>
@@ -73,19 +73,19 @@ exports[`preview-cover slot 1`] = `
<div class="van-uploader">
<div class="van-uploader__wrapper">
<div class="van-uploader__preview">
<div class="van-image van-uploader__preview-image"><img src="https://img.yzcdn.cn/vant/cat.jpeg" class="van-image__img" style="object-fit: cover;">
<div class="van-image van-uploader__preview-image"><img src="https://img01.yzcdn.cn/vant/cat.jpeg" class="van-image__img" style="object-fit: cover;">
<div class="van-image__loading"><i class="van-icon van-icon-photo van-image__loading-icon">
<!----></i></div>
<div class="van-uploader__preview-cover">url: https://img.yzcdn.cn/vant/cat.jpeg, index: 0</div>
<div class="van-uploader__preview-cover">url: https://img01.yzcdn.cn/vant/cat.jpeg, index: 0</div>
</div>
<div class="van-uploader__preview-delete"><i class="van-icon van-icon-cross van-uploader__preview-delete-icon">
<!----></i></div>
</div>
<div class="van-uploader__preview">
<div class="van-image van-uploader__preview-image"><img src="https://img.yzcdn.cn/vant/cat.jpeg" class="van-image__img" style="object-fit: cover;">
<div class="van-image van-uploader__preview-image"><img src="https://img01.yzcdn.cn/vant/cat.jpeg" class="van-image__img" style="object-fit: cover;">
<div class="van-image__loading"><i class="van-icon van-icon-photo van-image__loading-icon">
<!----></i></div>
<div class="van-uploader__preview-cover">url: https://img.yzcdn.cn/vant/cat.jpeg, index: 1</div>
<div class="van-uploader__preview-cover">url: https://img01.yzcdn.cn/vant/cat.jpeg, index: 1</div>
</div>
<div class="van-uploader__preview-delete"><i class="van-icon van-icon-cross van-uploader__preview-delete-icon">
<!----></i></div>
@@ -117,7 +117,7 @@ exports[`render preview image 1`] = `
<div class="van-uploader">
<div class="van-uploader__wrapper">
<div class="van-uploader__preview">
<div class="van-image van-uploader__preview-image"><img src="https://img.yzcdn.cn/vant/cat.jpeg" class="van-image__img" style="object-fit: cover;">
<div class="van-image van-uploader__preview-image"><img src="https://img01.yzcdn.cn/vant/cat.jpeg" class="van-image__img" style="object-fit: cover;">
<div class="van-image__loading"><i class="van-icon van-icon-photo van-image__loading-icon">
<!----></i></div>
</div>
@@ -127,7 +127,7 @@ exports[`render preview image 1`] = `
<div class="van-uploader__preview">
<div class="van-uploader__file"><i class="van-icon van-icon-description van-uploader__file-icon">
<!----></i>
<div class="van-uploader__file-name van-ellipsis">https://img.yzcdn.cn/vant/test.pdf</div>
<div class="van-uploader__file-name van-ellipsis">https://img01.yzcdn.cn/vant/test.pdf</div>
</div>
<div class="van-uploader__preview-delete"><i class="van-icon van-icon-cross van-uploader__preview-delete-icon">
<!----></i></div>
+5 -5
View File
@@ -9,8 +9,8 @@ const mockFileDataUrl = 'data:image/test';
const mockFile = new File([], 'test.jpg');
const file = { target: { files: [mockFile] } };
const multiFile = { target: { files: [mockFile, mockFile] } };
const IMAGE = 'https://img.yzcdn.cn/vant/cat.jpeg';
const PDF = 'https://img.yzcdn.cn/vant/test.pdf';
const IMAGE = 'https://img01.yzcdn.cn/vant/cat.jpeg';
const PDF = 'https://img01.yzcdn.cn/vant/test.pdf';
window.FileReader = function () {
this.readAsText = function () {
@@ -203,8 +203,8 @@ test('render preview image', async () => {
const wrapper = mount(Uploader, {
props: {
fileList: [
{ url: 'https://img.yzcdn.cn/vant/cat.jpeg' },
{ url: 'https://img.yzcdn.cn/vant/test.pdf' },
{ url: 'https://img01.yzcdn.cn/vant/cat.jpeg' },
{ url: 'https://img01.yzcdn.cn/vant/test.pdf' },
{ file: { name: 'test.pdf' } },
],
},
@@ -225,7 +225,7 @@ test('image-fit prop', () => {
const wrapper = mount(Uploader, {
props: {
imageFit: 'contain',
fileList: [{ url: 'https://img.yzcdn.cn/vant/cat.jpeg' }],
fileList: [{ url: 'https://img01.yzcdn.cn/vant/cat.jpeg' }],
},
});