TAU:我们如何将 PageIndicator 用于可穿戴设备

TAU: How do we use the PageIndicator for Wearable Devices

我正在尝试 Page Indicator in Tizen Wearable Application for Gear S3 Frontier. When I use the code pasted there, It works fine for text only. E.g. when I try to add controls on each section (being shown as page on the screen) It doesn't work. Even if I set a background image the whole design gets scattered. I've tried some approaches, including the answer given on

我的输出:

HTML代码:

第 1 页,共 2 页

第 2 页,共 2 页

CSS:

.ui-content section {
    overflow: hidden;
    overflow-y: auto;
    text-align: center;
}

JavaScript:

 /*global tau */
(function() {

var page = document.getElementById("taskListPage"),
    changer = document.getElementById("hsectionchanger"),
    sections = document.querySelectorAll("section"),
    sectionChanger,
    elPageIndicator = document.getElementById("pageIndicator"),
    pageIndicator,
    pageIndicatorHandler;

/**
 * pagebeforeshow event handler
 * Do preparatory works and adds event listeners
 */
page.addEventListener( "pagebeforeshow", function() {
    // make PageIndicator
    pageIndicator =  tau.widget.PageIndicator(elPageIndicator, { numberOfPages: sections.length });
    pageIndicator.setActive(0);
    // make SectionChanger object
    sectionChanger = new tau.widget.SectionChanger(changer, {
        circular: true,
        orientation: "horizontal",
        useBouncingEffect: true
    });
});

/**
 * pagehide event handler
 * Destroys and removes event listeners
 */
page.addEventListener( "pagehide", function() {
    // release object
    sectionChanger.destroy();
    pageIndicator.destroy();
});

/**
 * sectionchange event handler
 */
pageIndicatorHandler = function (e) {
    pageIndicator.setActive(e.detail.active);
};

changer.addEventListener("sectionchange", pageIndicatorHandler, false);

}());

我也遇到错误file:///lib/tau/wearable/js/tau.min.js (20) :[tau][10/24/2019, 1:28:31

未附加 HTML 代码。根据屏幕,我假设您的应用程序有两个部分。带有 "circular" 选项的 SectionChanger 小部件只能使用包含至少 3 个部分的应用程序构建,因此控制台中会出现错误。 请将部分更改器的循环选项更改为 false:

page.addEventListener( "pagebeforeshow", function() {
    // make PageIndicator
    pageIndicator =  tau.widget.PageIndicator(elPageIndicator, { numberOfPages: sections.length });
    pageIndicator.setActive(0);
    // make SectionChanger object
    sectionChanger = new tau.widget.SectionChanger(changer, {
        circular: true,
        orientation: "horizontal",
        useBouncingEffect: true
    });
});

进入:

page.addEventListener( "pagebeforeshow", function() {
    // make PageIndicator
    pageIndicator =  tau.widget.PageIndicator(elPageIndicator, { numberOfPages: sections.length });
    pageIndicator.setActive(0);
    // make SectionChanger object
    sectionChanger = new tau.widget.SectionChanger(changer, {
        circular: false,
        orientation: "horizontal",
        useBouncingEffect: true
    });
});

这个选项负责sections模式之间的切换。如果它设置为 true 用户可以从第一部分移动到最后一个部分,反之亦然。