动态添加渲染 模块 代码 如下
代码片
.
<script lang="tsx">
_sums = (
<div class="sum_row">
<div class="bottom-line">
{sum * 100}%<font style="display: none;">/</font>
</div>
<div></div>
</div>
);
</script>
<style lang="less" scoped>
.sum_row div {
min-height: 40px;
line-height: 40px;
width: 100%;
}
.sum_row .bottom-line {
position: relative;
}
.sum_row .bottom-line:after {
content: "";
position: absolute;
left: -10px;
right: -10px;
bottom: 0;
height: 1px;
background-color: #ebeef5;
}
</style>
解决方法
把 style 的 scoped 去除
<style lang="less">
新加一个 不存在 scoped 的 style
<style lang="less">
出现此问题的原因 可能为
当前页 style 添加 scoped 编译时 在当前页的范围内 未能找到 Jsx(Tsx) 中使用的类,
对代码进行了 优化删减
最后导致 编译后 样式 消失