gpt4 book ai didi

javascript - 无法使用 Builder.load() 动态加载组件

转载 作者:行者123 更新时间:2023-12-02 21:22:17 25 4
gpt4 key购买 nike

尝试使用代码进行动态加载:

  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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com