mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-05 05:42:44 +08:00
Merge branch 'dev' into next
This commit is contained in:
commit
b67d0f10f8
@ -51,6 +51,8 @@ npm i vant@next -S
|
||||
yarn add vant@next
|
||||
```
|
||||
|
||||
> Tips: Please install Vant 3.0 for Vue 3 projects, see [issue#7035](https://github.com/youzan/vant/issues/7035)
|
||||
|
||||
## Quickstart
|
||||
|
||||
```js
|
||||
|
@ -48,6 +48,8 @@ npm i vant@next -S
|
||||
yarn add vant@next
|
||||
```
|
||||
|
||||
> Tips: Vue 3 项目请安装 Vant 3.0,参见 [issue#7035](https://github.com/youzan/vant/issues/7035)
|
||||
|
||||
## 快速上手
|
||||
|
||||
```js
|
||||
|
@ -29,6 +29,8 @@ npm i vant@next -S
|
||||
yarn add vant@next
|
||||
```
|
||||
|
||||
> Tips: Please install Vant 3.0 for Vue 3 projects, see [issue#7035](https://github.com/youzan/vant/issues/7035)
|
||||
|
||||
## Usage
|
||||
|
||||
### 1. Import on demand
|
||||
|
@ -31,6 +31,8 @@ npm i vant@next -S
|
||||
yarn add vant@next
|
||||
```
|
||||
|
||||
> Tips: Vue 3 项目请安装 Vant 3.0,参见 [issue#7035](https://github.com/youzan/vant/issues/7035)
|
||||
|
||||
### 示例工程
|
||||
|
||||
我们提供了一个基于 Vue Cli 的[示例工程](https://github.com/youzan/vant-demo),示例工程会帮助你了解如下内容:
|
||||
|
@ -272,8 +272,15 @@ export default createComponent({
|
||||
let height = 0;
|
||||
let currentMonth;
|
||||
|
||||
// add offset to avoid rem accuracy issues
|
||||
// see: https://github.com/youzan/vant/issues/6929
|
||||
const viewportOffset = 50;
|
||||
const viewportTop = top - viewportOffset;
|
||||
const viewportBottom = bottom + viewportOffset;
|
||||
|
||||
for (let i = 0; i < months.length; i++) {
|
||||
const visible = height <= bottom && height + heights[i] >= top;
|
||||
const visible =
|
||||
height <= viewportBottom && height + heights[i] >= viewportTop;
|
||||
|
||||
if (visible && !currentMonth) {
|
||||
currentMonth = monthRefs[i];
|
||||
|
@ -39,12 +39,18 @@ function parseOptions(message) {
|
||||
return { message };
|
||||
}
|
||||
|
||||
function isInDocument(element) {
|
||||
return document.body.contains(element);
|
||||
}
|
||||
|
||||
function createInstance() {
|
||||
/* istanbul ignore if */
|
||||
if (!inBrowser) {
|
||||
return {};
|
||||
}
|
||||
|
||||
queue = queue.filter((item) => isInDocument(item.$el));
|
||||
|
||||
if (!queue.length || multiple) {
|
||||
const root = document.createElement('div');
|
||||
document.body.appendChild(root);
|
||||
|
@ -74,26 +74,31 @@ test('icon-prefix prop', async () => {
|
||||
expect(toast.$el.outerHTML).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('clear toast', () => {
|
||||
const toast1 = Toast();
|
||||
test('clear toast', async () => {
|
||||
const toast1 = Toast('1');
|
||||
await later();
|
||||
expect(toast1.value).toBeTruthy();
|
||||
Toast.clear();
|
||||
expect(toast1.value).toBeFalsy();
|
||||
|
||||
Toast.allowMultiple();
|
||||
const toast2 = Toast('2');
|
||||
await later();
|
||||
const toast3 = Toast('3');
|
||||
await later();
|
||||
Toast.clear(true);
|
||||
expect(toast2.value).toBeFalsy();
|
||||
expect(toast3.value).toBeFalsy();
|
||||
Toast.allowMultiple(false);
|
||||
});
|
||||
|
||||
test('clear multiple toast', () => {
|
||||
test('clear multiple toast', async () => {
|
||||
Toast.allowMultiple();
|
||||
Toast.clear(true);
|
||||
const toast1 = Toast.success('1');
|
||||
await later();
|
||||
const toast2 = Toast.success('2');
|
||||
await later();
|
||||
Toast.clear();
|
||||
expect(toast1.value).toBeFalsy();
|
||||
expect(toast2.value).toBeTruthy();
|
||||
|
@ -324,7 +324,10 @@ export default createComponent({
|
||||
|
||||
const PreviewCover = this.$slots['preview-cover'] && (
|
||||
<div class={bem('preview-cover')}>
|
||||
{this.$slots['preview-cover'](item)}
|
||||
{this.$slots['preview-cover']({
|
||||
index,
|
||||
...item,
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
|
||||
|
@ -76,7 +76,7 @@ exports[`preview-cover slot 1`] = `
|
||||
<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__loading"><i class="van-icon van-icon-photo van-image__loading-icon">
|
||||
<!----></i></div>
|
||||
<div class="van-uploader__preview-cover">https://img.yzcdn.cn/vant/cat.jpeg</div>
|
||||
<div class="van-uploader__preview-cover">url: https://img.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>
|
||||
@ -85,7 +85,7 @@ exports[`preview-cover slot 1`] = `
|
||||
<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__loading"><i class="van-icon van-icon-photo van-image__loading-icon">
|
||||
<!----></i></div>
|
||||
<div class="van-uploader__preview-cover">https://img.yzcdn.cn/vant/cat.jpeg</div>
|
||||
<div class="van-uploader__preview-cover">url: https://img.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>
|
||||
|
@ -531,7 +531,7 @@ test('preview-cover slot', () => {
|
||||
fileList: [{ url: IMAGE }, { url: IMAGE }],
|
||||
},
|
||||
scopedSlots: {
|
||||
'preview-cover': (item) => item.url,
|
||||
'preview-cover': (item) => `url: ${item.url}, index: ${item.index}`,
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -12,7 +12,10 @@ module.exports = {
|
||||
},
|
||||
site: {
|
||||
defaultLang: 'en-US',
|
||||
versions: [{ label: '1.x', link: 'https://youzan.github.io/vant/1.x/' }],
|
||||
versions: [
|
||||
{ label: '1.x', link: 'https://youzan.github.io/vant/1.x/' },
|
||||
{ label: '3.x', link: 'https://youzan.github.io/vant/next/' },
|
||||
],
|
||||
baiduAnalytics: {
|
||||
seed: 'ad6b5732c36321f2dafed737ac2da92f',
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user