uni-app分割线微信小程序端不显示

问题描述

做项目时,遇到一个问题:

自定义的分割线组件在web端能显示,在微信小程序端却不能显示

代码基本如下:

<template>
    <view>
        <hr class='divider' />
    </view>
</template>

<style>
    .divider {
        align-self: center;
        width: 100%;
        color: #987cb9;
        size: 10;
    }
</style>

解决方案

搜索发现 uni-app使用html语法时要慎重!!!

hr标签在微信小程序端失效了。

解决代码如下:

<template>
	  <view class="divider"/>
</template>

<style>
	.divider{
	 background: #E0E3DA;
	 width: 100%;
	 height: 5rpx;
	}
</style>

uni-app坑实在太多了!一不留神就踩坑了qwq。

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐