javascript - Nativescript vue slot 默认组件问题
问题描述
我试图用 nativescript-vue 创建一个移动应用程序,但在使用插槽时遇到了默认组件渲染的问题。所以有带有 Frame 和内部插槽的 App.vue。
<Frame ~mainContent>
<slot name="mainContent"></slot>
</Frame>
还有一个带有可用组件的路由器:
import EducationPlacesList from './components/EducationPlacesList'
import PersonalProfile from './components/PersonalProfile'
const router = {
EducationPlacesList: EducationPlacesList,
PersonalProfile: PersonalProfile
}
由于本机脚本 vue 目前不支持 Vue 路由器,因此有一个通过手动路由导航的解决方案,它工作得很好。我有一个带有标签的侧边栏,ontap
还有一个
this.$navigateTo(this.$router[to], options)
- 通过点击可以完美地重定向我。
但是,如果我启动我的应用程序并且不点击任何链接,则会出现预期的空白空间。因为在导航到某个页面之前插槽是空的。我想知道,有没有一个好的做法,如何设置这个插槽的默认组件。
解决方案
推荐阅读
- network-programming - 如何在网络编程中管理计时器任务这样的心跳?
- c# - 无法更改列表视图 xamarin.forms 中的字体大小
- ruby-on-rails - 如何判断 Rails 异常将呈现哪个错误状态代码?
- autodesk-forge - 伪造查看器错误
- amazon-web-services - 将 taskRoleArn 附加到 AWS Fargate 不起作用
- python - NTLK - 将名词分类为位置
- c# - 使用 C# 和 Aforge 在 Picturebox 中未显示 USB 摄像头馈送
- php - 使用间隔(以周数为单位)和开始日期计算未来日期
- arrays - 将 RDD[Array[Double]] 转换为 DataFrame[Array[Double]] 产生 DataFrame[WrappedArray]
- c++ - c++ socket编程:创建多个流