Oracle-jet с машинописным веб-компонентом

Я создал приложение с запуском машинописного текста:

ojet create web-app-navbar --template=navbar --typescript

то я запустил веб-компонент:

ojet create components demo-card --typescript

ojet cli успешно создал компонент демонстрационной карты. Я хочу добавить компонент демонстрационной карты на страницу about и добавить тег html:

// 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;
<!--
 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>

но он не отображается на странице. Как я могу добавить этот компонент в свое приложение?


person Денис Кучер    schedule 15.05.2020    source источник


Ответы (1)


Добавить import 'demo-card/loader' в about.ts

При использовании ojet cli путь к компоненту настраивается автоматически. Вам необходимо добавить import 'demo-card/loader' для автоматического определения правильного пути для транспилированного компонента.

person Sidharth V    schedule 04.06.2020
comment
Я думаю, он должен импортировать это в about.ts, верно? Он упомянул об этом сверху. - person Ray; 06.06.2020
comment
Да, я сам просматривал учебник, не заметил другого имени файла. Отредактировал это. Спасибо @Ray! - person Sidharth V; 07.06.2020