Node.js Platypi中ViewControl的注册函数的放置位置
我一直在浏览[Platypi.io/docs/getting started/][1],但在关于添加功能以允许用户注册演示应用程序()的部分遇到了问题 具体步骤如下: 现在,让我们添加注册函数。只要点击或点击plat按钮,就会触发此功能。在模板中,我们通过在plat tap属性中指定一个函数来定义按钮的点击事件。函数名为register,因此当单击该按钮时,将在ViewControl上启动register函数。将注册功能添加到视图控件(在public/viewcontrols/register/register.viewcontrol.ts中: 在何处添加此函数?如果将其放入RegisterViewControl(如[this][2])类中,我会收到以下错误:Node.js Platypi中ViewControl的注册函数的放置位置,node.js,typescript,Node.js,Typescript,我一直在浏览[Platypi.io/docs/getting started/][1],但在关于添加功能以允许用户注册演示应用程序()的部分遇到了问题 具体步骤如下: 现在,让我们添加注册函数。只要点击或点击plat按钮,就会触发此功能。在模板中,我们通过在plat tap属性中指定一个函数来定义按钮的点击事件。函数名为register,因此当单击该按钮时,将在ViewControl上启动register函数。将注册功能添加到视图控件(在public/viewcontrols/register/
错误TS2094:类型为“RegisterViewControl”的值上不存在属性“navigator”。this.navigator.navigate(HomeViewControl);
在类之外,语法不起作用
我熟悉Javascript,但对TypeScript不太熟悉。有什么建议吗?您的
RegisterViewControl
应该扩展BaseViewControl
,在某种程度上,它应该扩展plat.ui.ViewControl
plat.ui.ViewControl上有一个名为navigator
的属性ror,看来RegisterViewControl
的定义可能有问题
如果上述解决方案不起作用,能否提供整个RegisterViewControl文件的代码
编辑:它看起来确实正确。声明.d.ts
文件可能有问题。请尝试删除.tscache
文件夹,然后再次运行npm install
。这可能会给您带来更多有用的错误
我们最近(与昨天一样)更新了框架和UI项目,以部署不同的结构。在您的public/typings/tsd.d.ts
中,您可能有以下参考:
/// <reference path="../../node_modules/platypus/platypus.d.ts" />
/// <reference path="../../node_modules/platypusui/platypusui.d.ts" />
如果是这种情况,您还应该进入public/common/css/main.less
文件并更改此行:
@import "../../../node_modules/platypusui/platypus";
为此:
@import "../../../node_modules/platypusui/dist/platypus";
看起来我对该文件要点的链接丢失了:这是我实现了您的更改的整个文件,现在
grunt
运行时没有错误,但是localhost:3000仍然只显示“Hello World”我应该看到输出上的其他更改吗?好的。注册和登录时需要所有操作,但在home.viewcontrol.ts中,我不断收到错误,即找不到外部模块../order/order.viewcontrol
,我导入了文件顶部确保您在。/order/order.viewcontrol
,a使用export=OrderViewControl
构造导出ViewControl。
@import "../../../node_modules/platypusui/platypus";
@import "../../../node_modules/platypusui/dist/platypus";