【问题标题】:How to customize Pull-To-Refresh indicator style in NativeScript/Vue?如何在 NativeScript/Vue 中自定义 Pull-To-Refresh 指示器样式?
【发布时间】:2019-11-20 10:27:29
【问题描述】:

我正在尝试在 NativeScript/Vue 应用程序中自定义 Pull-To-Refresh 指示器的样式。 Vue 似乎没有示例代码。我尝试将以下从 Angular 改编的代码放入,运行应用时出错。

<RadListView.pullToRefreshStyle>
    <PullToRefreshStyle indicatorColor="white" indicatorBackgroundColor="blue"/>
</RadListView.pullToRefreshStyle>

任何人都可以提供一个工作示例或更新以下页面吗? https://docs.nativescript.org/vuejs/ns-ui/ListView/pull-to-refresh

附带说明,根据此处的文档: https://docs.nativescript.org/ns-ui-api-reference/classes/pulltorefreshstyle

只能自定义颜色和背景颜色。有没有办法绕过指标的这种变化大小?

我能想到的唯一方法是将指示器的前景和背景都设置为透明,然后使用页面级别的activityIndi​​cator。

【问题讨论】:

    标签: vue.js nativescript


    【解决方案1】:

    只需在pullToRefreshStyle 属性上设置属性

    HTML

    <RadListView :pullToRefreshStyle="pullToRefreshStyle">
    

    脚本

    import * as colorModule from "tns-core-modules/color";
    
    data() {
            return {
                pullToRefreshStyle: {
                    indicatorColor: new colorModule.Color("red"),
                    indicatorBackgroundColor: new colorModule.Color("green")
                }
            };
    }
    

    【讨论】:

    • 这行得通。有没有办法完全关闭 pullToRefreshIndicator?我尝试将背景和前景色都设置为“#ffffff”,但我仍然有一个空圆圈。
    • 我不这么认为,插件不支持。
    • 我想我们将不得不等到插件支持自定义大小和位置等。你能更新示例代码页吗?
    猜你喜欢
    • 1970-01-01
    • 2015-08-07
    • 1970-01-01
    • 2011-06-02
    • 2016-04-08
    • 1970-01-01
    • 2018-03-15
    • 2019-08-13
    • 2013-01-14
    相关资源
    最近更新 更多