Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue2 项目打包成 app 后不能通过 this.$slots.xx 判断是否使用插槽 #5353

Open
monkeying-boy opened this issue Mar 18, 2025 · 0 comments

Comments

@monkeying-boy
Copy link

发行方式

App

具体平台

Android 12( mumu 模拟器上运行)

开发环境

Windows

项目创建方式

HBuilderX

依赖版本

HBuilderX 版本为 4.56

问题描述

在 vue 文件中使用 this.$slots.default 判断是否使用插槽,在 h5 运行没有问题,但是打包 apk 后在mumu 模拟器上运行后发现代码中的 this.$slots.default 为 false 实际上是传了插槽并且插槽内容能正常显示,但是通过 Boolean(this.$slots.default) 却返回的是 false。最后再通过 hbuilder 编辑器创建了一个新的 vue2 uni-app 项目也能复现该问题,复现代码如下

app-slots-demo.zip

重现步骤

将复现 demo 放在 hbuilder 中并在模拟器中运行即可

期望行为

app 显示与 h5 表现一致

实际行为

app 显示与 h5 表现不一致

截图或录屏

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant