尝试使用代码进行动态加载:
var myComponentInstance = Builder.load({
path: "~/components/my-control",
name: "MyControl"
});
console.log(myComponentInstance);
return myComponentInstance;
并收到错误:
错误:[object Object] 不是有效的 View 实例。
谁能帮我加载组件吗?请参阅下面的 Playground 链接:
https://play.nativescript.org/?template=play-js&id=SoGnxo&v=18
最佳答案
应该是
var myComponentInstance = Builder.load({
path: "~/components",
name: "my-control"
});
其中路径应为文件夹,名称应为组件。
关于javascript - 无法使用 Builder.load() 动态加载组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60814557/