Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Platypi中ViewControl的注册函数的放置位置_Node.js_Typescript - Fatal编程技术网

Node.js Platypi中ViewControl的注册函数的放置位置

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/

我一直在浏览[Platypi.io/docs/getting started/][1],但在关于添加功能以允许用户注册演示应用程序()的部分遇到了问题

具体步骤如下:

现在,让我们添加注册函数。只要点击或点击plat按钮,就会触发此功能。在模板中,我们通过在plat tap属性中指定一个函数来定义按钮的点击事件。函数名为register,因此当单击该按钮时,将在ViewControl上启动register函数。将注册功能添加到视图控件(在public/viewcontrols/register/register.viewcontrol.ts中:

在何处添加此函数?如果将其放入RegisterViewControl(如[this][2])类中,我会收到以下错误:
错误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";