Compare commits

..

No commits in common. "9b3a473061404fb3e77bdb5c876ad428f4048f5a" and "8043a9e0fea9d67cd1d257d25702a660ff2e2f5e" have entirely different histories.

6 changed files with 6 additions and 33 deletions

View File

@ -19,15 +19,6 @@ Vant follows [Semantic Versioning 2.0.0](https://semver.org/lang/zh-CN/).
## Details
### [v4.0.4](https://github.com/vant-ui/vant/compare/v4.0.3...v4.0.4)
`2022-12-23`
**Bug Fixes**
- Field: incorrect cursor position when value length exceeds maxlength or when formatter is used [#11360](https://github.com/vant-ui/vant/issues/11360)
- Image: load event missing params [#11406](https://github.com/vant-ui/vant/issues/11406)
### [v4.0.3](https://github.com/vant-ui/vant/compare/v4.0.2...v4.0.3)
`2022-12-13`

View File

@ -19,15 +19,6 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。
## 更新内容
### [v4.0.4](https://github.com/vant-ui/vant/compare/v4.0.3...v4.0.4)
`2022-12-23`
**Bug Fixes**
- Field: 修复使用 formatter 时光标位置可能错误的问题 [#11360](https://github.com/vant-ui/vant/issues/11360)
- Image: 修复 load 事件未正确触发导致 ImagePreview 报错的问题 [#11406](https://github.com/vant-ui/vant/issues/11406)
### [v4.0.3](https://github.com/vant-ui/vant/compare/v4.0.2...v4.0.3)
`2022-12-13`

View File

@ -1,6 +1,6 @@
{
"name": "vant",
"version": "4.0.4",
"version": "4.0.3",
"description": "Mobile UI Components built on Vue",
"main": "lib/vant.cjs.js",
"module": "es/index.mjs",

View File

@ -96,22 +96,13 @@ export default defineComponent({
}
);
const onLoad = (event: Event) => {
const onLoad = (event?: Event) => {
if (loading.value) {
loading.value = false;
emit('load', event);
}
};
const triggerLoad = () => {
const loadEvent = new Event('load');
Object.defineProperty(loadEvent, 'target', {
value: imageRef.value,
enumerable: true,
});
onLoad(loadEvent);
};
const onError = (event?: Event) => {
error.value = true;
loading.value = false;
@ -181,7 +172,7 @@ export default defineComponent({
const onLazyLoaded = ({ el }: { el: HTMLElement }) => {
const check = () => {
if (el === imageRef.value && loading.value) {
triggerLoad();
onLoad();
}
};
if (imageRef.value) {
@ -215,7 +206,7 @@ export default defineComponent({
onMounted(() => {
nextTick(() => {
if (imageRef.value?.complete) {
triggerLoad();
onLoad();
}
});
});

View File

@ -125,7 +125,7 @@ app.use(Lazyload);
| Event | Description | Arguments |
| ----- | ------------------------------ | ------------------- |
| click | Emitted when image is clicked | _event: MouseEvent_ |
| load | Emitted when image loaded | _event: Event_ |
| load | Emitted when image loaded | - |
| error | Emitted when image load failed | - |
### Slots

View File

@ -151,7 +151,7 @@ app.use(Lazyload);
| 事件名 | 说明 | 回调参数 |
| ------ | ------------------ | ------------------- |
| click | 点击图片时触发 | _event: MouseEvent_ |
| load | 图片加载完毕时触发 | _event: Event_ |
| load | 图片加载完毕时触发 | - |
| error | 图片加载失败时触发 | - |
### Slots