5***@163.com
5***@163.com
  • 发布:2025-08-27 00:05
  • 更新:2025-08-27 00:05
  • 阅读:15

【报Bug】UNIAPP与node_modules的样式冲突。

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: windows11

HBuilderX类型: 正式

HBuilderX版本号: 4.76

手机系统: Android

手机系统版本号: Android 16

手机厂商: 小米

手机机型: 11

页面类型: vue

vue版本: vue3

打包方式: 云端

项目创建方式: HBuilderX

操作步骤:

安装wangeditor,然后报错。

预期结果:

样式不被uniapp(篡改)编译。

实际结果:

button编译为uni-button

bug描述:

UNIAPP在编译时,会将一些元素样式编译为uni版本,比如将button编译为uni-button,这会是的node_modules中的样式发生异常。

在使用wangeditor开发的web项目中,import '@wangeditor/editor/dist/css/style.css' // 引入 css

在编译(包括测试)后

.w-e-bar-item, .w-e-bar-item button {
align-items: center;
justify-content: center;
}

被替换为了
.w-e-bar-item, .w-e-bar-item uni-button {
align-items: center;
justify-content: center;
}
且造成

.w-e-bar-item button {
background: transparent;
border: none;
color: var(--w-e-toolbar-color);
cursor: pointer;
display: inline-flex;
height: 32px;
overflow: hidden;
padding: 0 8px;
white-space: nowrap;
}

无法正常加载,以至于样式错乱。

2025-08-27 00:05 负责人:无 分享
已邀请:

要回复问题请先登录注册