首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Oracle-jet与typescript web组件

Oracle-jet与typescript web组件
EN

Stack Overflow用户
提问于 2020-05-15 21:38:21
回答 1查看 517关注 0票数 2

我已经用typescript run创建了应用程序:

代码语言:javascript
复制
ojet create web-app-navbar --template=navbar --typescript

然后我创建了web组件运行:

代码语言:javascript
复制
ojet create components demo-card --typescript

ojet cli已成功创建demo-card组件。我想添加演示卡组件到关于页面,我已经添加了html标签:

代码语言:javascript
复制
// IT IS about.ts
class AboutViewModel {

  constructor() {

  }

  /**
   * Optional ViewModel method invoked after the View is inserted into the
   * document DOM.  The application can put logic that requires the DOM being
   * attached here. 
   * This method might be called multiple times - after the View is created
   * and inserted into the DOM and after the View is reconnected
   * after being disconnected.
   */
  connected(): void {
    // implement if needed
  }

  /**
   * Optional ViewModel method invoked after the View is disconnected from the DOM.
   */
  disconnected(): void {
    // implement if needed
  }

  /**
   * Optional ViewModel method invoked after transition to the new View is complete.
   * That includes any possible animation between the old and the new View.
   */
  transitionCompleted(): void {
    // implement if needed
  }
}

export default AboutViewModel;
代码语言:javascript
复制
<!--
 Copyright (c) 2014, 2020, Oracle and/or its affiliates.
 The Universal Permissive License (UPL), Version 1.0
 -->
 <!-- IT IS about.html view -->
<div class="oj-hybrid-padding">
  <h1>About Content Area</h1>
  <div>
      To change the content of this section, you will make edits to the about.html file located in the /js/views folder.
  </div>
  <deno-card></deno-card>
</div>

但它不会显示在页面上。如何将此组件添加到我的应用程序中?

EN

回答 1

Stack Overflow用户

发布于 2020-06-04 15:57:56

about.ts添加import 'demo-card/loader'

使用ojet cli时,会自动为您设置组件的路径。您需要添加import 'demo-card/loader'来自动解析已转换组件的正确路径。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61820657

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档