Несколько полноэкранных в режиме прокрутки с Nativescript - PullRequest
0 голосов
/ 01 мая 2020

Я хотел бы знать, как я могу иметь несколько полноэкранных изображений в режиме прокрутки с nativescript, пожалуйста?

enter image description here

Я пробовал это:

<Page actionBarHidden="true" class="page">
    <ScrollView orientation="vertical">
        <StackLayout>
            <StackLayout height="100%" backgroundColor="red">
<Label text="Fullscreen 1"></Label>
            </StackLayout>

            <StackLayout height="100%" backgroundColor="blue">
<Label text="Fullscreen 2"></Label>
            </StackLayout>
        </StackLayout>
    </ScrollView>
</Page>

Но стек не полноэкранный.

1 Ответ

0 голосов
/ 01 мая 2020

Я исправил это:

Шаблон

<Page actionBarHidden="true">
    <ScrollView orientation="vertical">
        <StackLayout>
            <StackLayout :height="screenHeight" backgroundColor="red">
                ...
            </StackLayout>

            <StackLayout :height="screenHeight" backgroundColor="blue">
                ...
            </StackLayout>
        </StackLayout>
    </ScrollView>
</Page>

И добавьте это:

import { screen } from "tns-core-modules/platform";

...
data() {
    return {
        screenHeight: 0
    };
},
...
created() {
    this.screenHeight = screen.mainScreen.heightDIPs
}
...