fix(lazyload): lazy-image h is not a function (#11229)

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 文档 h 渲染函数](https://cn.vuejs.org/api/render-function.html#h)
This commit is contained in:
若川 2022-11-08 10:16:20 +08:00 committed by GitHub
parent 842c92d3c9
commit f071e48be2
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() {