javascript - Vue Native App中如何实现nativescript-loading-indicator
问题描述
IM 试图实现 nstudio/nativescript-loading-indicator 但在我的 Vue Native App 中无法正常工作
import {LoadingIndicator,Mode,OptionsCommon} from '@nstudio/nativescript-loading-indicator';
const indicator = new LoadingIndicator();
export default {
data() {
return {
}
},
mounted() {
indicator.show();
this.homeFirstbanner();
this.justArrivals();
this.getCategory();
}
}
解决方案
const LoadingIndicator = require('@nstudio/nativescript-loading-indicator').LoadingIndicator;
const Mode = require('@nstudio/nativescript-loading-indicator').Mode;
const loader = new LoadingIndicator();
import { Page } from 'tns-core-modules/ui/page';
// optional options
// android and ios have some platform specific options
const options = {
message: 'Loading...',
details: 'Additional detail note!',
progress: 0.65,
margin: 10,
dimBackground: true,
color: '#4B9ED6', // color of indicator and labels
// background box around indicator
// hideBezel will override this if true
backgroundColor: 'yellow',
userInteractionEnabled: false, // default true. Set false so that the touches will fall through it.
hideBezel: true, // default false, can hide the surrounding bezel
mode: Mode.AnnularDeterminate, // see options below
android: {
view: page.getViewById('stackView'), // Target view to show on top of (Defaults to entire window)
cancelable: true,
cancelListener: function(dialog) {
console.log('Loading cancelled');
}
},
ios: {
view: page.getViewById('stackView') // Target view to show on top of (Defaults to entire window)
}
};
loader.show(options); // options is optional
// Do whatever it is you want to do while the loader is showing, then
loader.hide();
该视图应该是您界面中的有效 uiView。只需给 StackLayout 一个 Id,然后定位它。前任:view: page.getViewById("stackLayout")
更新
推荐阅读
- google-chrome - 使用 Chrome 远程调试 Android 设备重定向 URL
- c# - 生产者消费者模型中队列为空时消费者的最佳行为是什么
- windows - Powershell 删除文件名中的 Em Dash 无法识别 Em Dash
- c++ - 支持两个具有不同语义的整数构造函数
- visual-studio - Visual Studio Post-Build 事件 - 如果文件位于子文件夹中,如何将文件复制到输出(bin)目录(仅当较新时)
- c++ - Incredibuild,编译期间的内部 LD_PRELOAD 错误
- python - 有条件地计算列的最大值和最小值
- azure-devops - 如何在已发布的工件中包含测试程序集?
- python - 我似乎无法将 tensorflow 导入 python VSCODE
- regex - 正则表达式以确保范围内的每个数字都匹配一次