如何用aurelia cli创建一个新组件?

时间:2017-07-08 16:00:27

标签: aurelia aurelia-cli

是否有创建新组件的命令,而不是手动创建新文件?与<template> <!-- Hello template --> </template> 类似,但仅适用于组件:

hello.html的

export class Hello {

  constructor() {

  }

}

hello.js

not null

1 个答案:

答案 0 :(得分:5)

在命令行键入au generate将为您提供以下选项列表:

$ au generate
                      _ _          ____ _     ___
  __ _ _   _ _ __ ___| (_) __ _   / ___| |   |_ _|
 / _` | | | | '__/ _ \ | |/ _` | | |   | |    | |
| (_| | |_| | | |  __/ | | (_| | | |___| |___ | |
 \__,_|\__,_|_|  \___|_|_|\__,_|  \____|_____|___|

No Generator Specified. Available Generators:

attribute

    Creates a custom attribute class and places it in the project resources.

binding-behavior

    Creates a binding behavior class and places it in the project resources.

component

    Creates a custom component class and template (view model and view), placing them in the project source folder (or optionally in sub folders).

element

    Creates a custom element class and template, placing them in the project resources.

generator

    Creates a generator class and places it in the project generators folder.

task

    Creates a task and places it in the project tasks folder.

value-converter

    Creates a value converter class and places it in the project resources.

只需输入au generate X,其中X是列出的选项之一。例如au generate component