mirror of
https://gitee.com/vant-contrib/vant.git
synced 2026-07-07 23:21:07 +08:00
Compare commits
3 Commits
8043a9e0fe
...
9b3a473061
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b3a473061 | ||
|
|
5bcae75f08 | ||
|
|
0ee41a41a9 |
@ -19,6 +19,15 @@ 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`
|
||||
|
||||
@ -19,6 +19,15 @@ 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`
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vant",
|
||||
"version": "4.0.3",
|
||||
"version": "4.0.4",
|
||||
"description": "Mobile UI Components built on Vue",
|
||||
"main": "lib/vant.cjs.js",
|
||||
"module": "es/index.mjs",
|
||||
|
||||
@ -96,13 +96,22 @@ 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;
|
||||
@ -172,7 +181,7 @@ export default defineComponent({
|
||||
const onLazyLoaded = ({ el }: { el: HTMLElement }) => {
|
||||
const check = () => {
|
||||
if (el === imageRef.value && loading.value) {
|
||||
onLoad();
|
||||
triggerLoad();
|
||||
}
|
||||
};
|
||||
if (imageRef.value) {
|
||||
@ -206,7 +215,7 @@ export default defineComponent({
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
if (imageRef.value?.complete) {
|
||||
onLoad();
|
||||
triggerLoad();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -125,7 +125,7 @@ app.use(Lazyload);
|
||||
| Event | Description | Arguments |
|
||||
| ----- | ------------------------------ | ------------------- |
|
||||
| click | Emitted when image is clicked | _event: MouseEvent_ |
|
||||
| load | Emitted when image loaded | - |
|
||||
| load | Emitted when image loaded | _event: Event_ |
|
||||
| error | Emitted when image load failed | - |
|
||||
|
||||
### Slots
|
||||
|
||||
@ -151,7 +151,7 @@ app.use(Lazyload);
|
||||
| 事件名 | 说明 | 回调参数 |
|
||||
| ------ | ------------------ | ------------------- |
|
||||
| click | 点击图片时触发 | _event: MouseEvent_ |
|
||||
| load | 图片加载完毕时触发 | - |
|
||||
| load | 图片加载完毕时触发 | _event: Event_ |
|
||||
| error | 图片加载失败时触发 | - |
|
||||
|
||||
### Slots
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user