vue3问题
使用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>
去掉 reduce-loader 和 vue-improve-loader 后,看看编译是否正常?除此之外 vue 模板编译 kbone 就没有插手过了,全是 vue 自己做的。
也可以试试构建成 web,如果 web 可以的话,那编译模板这块尝试对齐到 web 就行。
去掉 reduce-loader 和 vue-improve-loader 后问题依然存在,web构建一直没有问题,现在的解决办法是把最外面的div换成 wx-view, 就能编译通过。
那不应该,kbone 构建时按道理不会插手任何框架相关的处理。
给一下可以复现问题的完整 demo 我试试?
在vue3.2下复现总结:template下不写一个根div, 就无法渲染
在vue3.2下复现总结:template下不写一个根div, 就无法渲染
我将 demo26 切到 3.2.31 版本,然后 template 根 div 下补充多个平行的 div,仍然是可以正常渲染的。
该问题是否仍存在?是的话看能不能抽一个可以完整复现的 demo 给我?