1.Application的基本单元是page,每个page 有一个XML文件定义布局,NativeScript在解析XML时,会寻找同名的.ts/.js文件,并加载执行其中的逻辑。

2.每个应用有默认的home页,应用启动时,加载home页。

import application = require("application");

// Start the application. Don't place any code after this line.

application.start({ moduleName: "my-page" });

3.每个application有一个frame at the root level, 负责页面间的导航

// To import the "ui/frame" module:

import frames = require("ui/frame");

// Navigate to page called “my-page”

frames.topmost().navigate("my-page");

4,可以采用如下方式指定page的xml和css文件

<Page import="~/your-code-file" cssFile="~/your-styles.css">

<StackLayout>

 ...

<StackLayout>

</Page>

results matching ""

    No results matching ""