Ionic 2 手册

Improve this doc

Now that you haveIonic and its dependencies installed, you can build your first app! This section will guide you through the process of starting a new application, adding pages, navigating between those pages, and more. Let’s get started!

Ionic uses TypeScript for its code. If you’re unfamiliar with TypeScript, take a look atthis page.

开启一个新的 Ionic 2 应用

启动一个新应用非常容易! 在命令行, 运行如下命令:

$ ionic start MyIonic2Project tutorial --v2
  • start will tell the CLI create a new app.
  • MyIonic2Project will be the directory name and the app name from your project.
  • tutorial will be the starter template for your project.
  • --v2 tells the CLI that you want a 2.0 project.

Along with creating your project, this will also installnpm modulesfor the application, and getCordovaset up and ready to go.

If the tutorial template isn’t something you want to use, Ionic has a few templates available:

  • tabs: 一个简单的三选项卡布局
  • sidemenu: 可切换边栏菜单布局
  • blank: 单页裸启动
  • super: 带有超过14可以使用页面设计的起动器项目
  • tutorial: 引导启动项目

如果没有指定模板运行ionic start MyIonic2Project --v2, 默认使用 tabs template .

在浏览器中查看应用

现在, 通过cd进入创建的文件夹. To get a quick preview of your app in the browser, use theservecommand.

$ cd MyIonic2Project/

$ ionic serve

You should see the welcome message shown above if everything was installed successfully.

In the next section, let’s go over the project structure created by theionic startcommand.

results matching ""

    No results matching ""