顾问
顾问
  • 发布:2022-03-30 10:28
  • 更新:2023-02-04 17:27
  • 阅读:859

使用渲染函数后uniapp的标签没有编译

分类:uni-app

这个是正常情况

这个是使用渲染函数后

import { defineComponent, withCtx, h, toRefs, resolveComponent, openBlock, createBlock, createElementVNode, createVNode } from 'vue';  
import './index.scss';  
export default defineComponent({  
    props: {  
        src: {  
            type: String,  
            default: '',  
        },  
        lazyLoad: {  
            type: Boolean,  
            default: true,  
        },  
        mode: {  
            type: String,  
            default: 'scaleToFill',  
        },  
    },  
    setup () {},  
    render(ctx: any) {  
        const resolveComponentView = resolveComponent('uni-view');  
        return (openBlock(), createBlock(resolveComponentView, {  
            class: 'bl-image-box width-100 height-100',  
        }, {  
            default: withCtx(_ => [  
                createElementVNode('uni-image', {  
                    class: 'width-100 height-100',  
                    src: ctx.src,  
                    mode: ctx.mode,  
                    lazyLoad: ctx.lazyLoad,  
                }, null, 8/* PROPS */, ['src', 'mode', 'lazyLoad'])  
            ], undefined, true),  
            _: 1  
        }))  
    }  
});  
2022-03-30 10:28 负责人:无 分享
已邀请:
g***@163.com

g***@163.com

没人回答吗?能不能用render+h

要回复问题请先登录注册