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:
若川 2022-11-08 10:14:49 +08:00 committed by GitHub
parent 97d2badd45
commit 711f9cc852
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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() {