Felhasználói eszközök

Eszközök a webhelyen


oktatas:telefon:nativescript:template-hello-world-ts

Ez a dokumentum egy előző változata!


< NativeScript

NativeScript - template-hello-world-ts

Indulás

ns create HelloWorld --template @nativescript/template-hello-world-ts

Könyvtárszerkezet

app01/
  |-app/
  |  |-app-root.xml
  |  |-app.css
  |  |-app.ts
  |  |-main-pages.ts
  |  |-main-pages.xml
  |  `-man-view-model.ts
  |-App_Resources/
  |-hooks/
  |-node_modules/
  |-platforms/
  |-.editorconfig
  |-.gitignore
  |-nativescript.config.ts
  |-package-lock.json
  |-package.json
  |-references.d.ts
  |-tsconfig.json
  `-webpack.config.js

A főlap

app/main-page.xml
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo">
    <ActionBar title="My App" icon="" />
 
    <StackLayout class="p-20">
        <Label text="Tap the button" class="h1 text-center" />
        <Button text="TAP" tap="{{ onTap }}" class="-primary" />
        <Label text="{{ message }}" class="h2 text-center" textWrap="true" />
    </StackLayout>
</Page>
app/main-page.ts
import { EventData, Page } from '@nativescript/core'
import { HelloWorldModel } from './main-view-model'
 
export function navigatingTo(args: EventData) {
  const page = <Page>args.object
  page.bindingContext = new HelloWorldModel()
}
oktatas/telefon/nativescript/template-hello-world-ts.1679686025.txt.gz · Utolsó módosítás: 2023/03/24 20:27 szerkesztette: admin