kbone icon indicating copy to clipboard operation
kbone copied to clipboard

vue3问题

Open zairl23 opened this issue 3 years ago • 6 comments

使用vue3.2, 如下的template编译报错:

<template>
    <div class="flex items-center">
        <div>
            <div :style="{ width: '30%' }">手机号</div>
            <div :style="{ width: '70%' }">xxx</div>
        </div>
        <div>
            <div :style="{ width: '30%' }">手机号</div>
            <div :style="{ width: '70%' }">xxx</div>
        </div>
    </div>
</template>

错误:

VM28 WAService.js:2 TypeError: Cannot read property 'cloneNode' of undefined at insertStaticContent。。。

这样注释一个div, 可通过:

<template>
    <div class="flex items-center">
        <div>
            <div :style="{ width: '30%' }">手机号</div>
            <div :style="{ width: '70%' }">xxx</div>
        </div>
        <div>
            <div :style="{ width: '30%' }">手机号</div>
            <!--<div :style="{ width: '70%' }">xxx</div>-->
        </div>
    </div>
</template>

改部分div 为 wx-view 也可以通过:

<template>
    <!-- <Nav title="编辑地址"></Nav> -->
    <div class="flex items-center">
        <div>
            <div :style="{ width: '30%' }">手机号</div>
            <div :style="{ width: '70%' }">xxx</div>
        </div>
        <div>
            <wx-view :style="{ width: '30%' }">手机号</wx-view>
            <wx-view :style="{ width: '70%' }">xxx</wx-view>
        </div>
    </div>
</template>

zairl23 avatar Feb 19 '22 12:02 zairl23

去掉 reduce-loader 和 vue-improve-loader 后,看看编译是否正常?除此之外 vue 模板编译 kbone 就没有插手过了,全是 vue 自己做的。

也可以试试构建成 web,如果 web 可以的话,那编译模板这块尝试对齐到 web 就行。

JuneAndGreen avatar Feb 21 '22 03:02 JuneAndGreen

去掉 reduce-loader 和 vue-improve-loader 后问题依然存在,web构建一直没有问题,现在的解决办法是把最外面的div换成 wx-view, 就能编译通过。

zairl23 avatar Mar 02 '22 13:03 zairl23

那不应该,kbone 构建时按道理不会插手任何框架相关的处理。

给一下可以复现问题的完整 demo 我试试?

JuneAndGreen avatar Mar 03 '22 06:03 JuneAndGreen

在vue3.2下复现总结:template下不写一个根div, 就无法渲染

zairl23 avatar Mar 20 '22 04:03 zairl23

在vue3.2下复现总结:template下不写一个根div, 就无法渲染

我将 demo26 切到 3.2.31 版本,然后 template 根 div 下补充多个平行的 div,仍然是可以正常渲染的。

JuneAndGreen avatar Mar 29 '22 10:03 JuneAndGreen

该问题是否仍存在?是的话看能不能抽一个可以完整复现的 demo 给我?

JuneAndGreen avatar Jul 07 '22 02:07 JuneAndGreen