mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(lazyload): lazy-image h is not a function (#11230)
in vue 3.x h is not function. this.$slots.default is a function. [vue 3.x refs render-function-api-change](https://github.com/vuejs/rfcs/blob/master/active-rfcs/0008-render-function-api-change.md) [vue 3.x docs h](https://cn.vuejs.org/api/render-function.html#h) - reappear - test ```vue // vant/packages/vant/src/lazyload/demo/index.vue <script lang="ts"> import Lazyload from '..'; if (window.app) { window.app.use(Lazyload, { lazyComponent: true, lazyImage: true }); } </script> <template> <demo-block :title="t('basicUsage')"> <lazy-image v-for="img in imageList" :key="img" :src="img"> </lazy-image> </demo-block> </teamplate> ```
This commit is contained in:
parent
97d2badd45
commit
711f9cc852
@ -6,6 +6,7 @@
|
|||||||
import { useRect } from '@vant/use';
|
import { useRect } from '@vant/use';
|
||||||
import { loadImageAsync } from './util';
|
import { loadImageAsync } from './util';
|
||||||
import { noop } from '../../utils';
|
import { noop } from '../../utils';
|
||||||
|
import { h } from 'vue';
|
||||||
|
|
||||||
export default (lazyManager) => ({
|
export default (lazyManager) => ({
|
||||||
props: {
|
props: {
|
||||||
@ -15,15 +16,13 @@ export default (lazyManager) => ({
|
|||||||
default: 'img',
|
default: 'img',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
render(h) {
|
render() {
|
||||||
return h(
|
return h(
|
||||||
this.tag,
|
this.tag,
|
||||||
{
|
{
|
||||||
attrs: {
|
src: this.renderSrc,
|
||||||
src: this.renderSrc,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
this.$slots.default
|
this.$slots.default?.()
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user