Skip to main content

启动应用

开始一个新的 Ionic 应用非常简单。在命令行中,运行 ionic start 命令,CLI 将处理其余部分。

🌐 Starting a new Ionic app is incredibly simple. From the command line, run the ionic start command and the CLI will handle the rest.

$ ionic start

Every great app needs a name! 😍

Please enter the full name of your app. You can change this at any time.
To bypass this prompt next time, supply name,
the first argument to ionic start.

? Project name: █

Ionic CLI 会显示提示,询问新项目的名称以及要使用的模板。这些信息可以作为命令参数提供:

🌐 The Ionic CLI will display prompts asking for the new project's name and which template to use. These details can be provided as command arguments:

$ ionic start myApp tabs

这里,myApp 是项目的名称,tabs 是起始模板,项目类型是 angular

🌐 Here, myApp is the name of the project, tabs is the starter template, and the project type is angular.

tabs 并不是唯一可用的项目模板。在所有项目类型中,共有三种模板可用:

  • tabs:基于选项卡的布局
  • sidemenu:基于侧菜单的布局
  • blank:具有单页的空项目

使用以下命令查看所有可用模板:

🌐 See all available templates with the following command:

$ ionic start --list

这些模板为任何应用提供了一个很好的起点,并包含了扩展代码库的所有最佳实践。

🌐 These templates provide a great starting point for any app and include all the best practices for making a code base scale.