cordova-plugin-ths-toast2
v1.0.7
Published
展示提示框
Downloads
3
Maintainers
Readme
cordova-plugin-ths-toast
弹出提示框 cordova插件
支持平台
Android
安装插件
# 通过npm 安装插件
cordova plugin add cordova-plugin-ths-toast
# 通过github安装
cordova plugin add https://github.com/THS-FE/cordova-plugin-ths-toast
# 通过本地文件路径安装
cordova plugin add 文件路径
说明: ionic 项目命令前加上ionic,即ionic cordova plugin xxxxx
参数说明:
- DEFAULT_DELAY 默认提示框延迟弹出的毫秒数
配置文件修改
在config.xml文件中 platform name="android" 节点下添加以下配置
<preference name="DEFAULT_DELAY" value="1000"/>
使用方法
显示提示框
/**
* 显示提示框
* @param text 显示文字
* @param success 成功的回调函数
*/
showToast(text, success) {
try {
ThsToast.show(text, success, err => {
console.log('err', err);
this.commUtilProvider.showToast('显示提示框失败');
})
}
catch (err) {
console.log(err);
}
};
隐藏提示框
/**
* 隐藏提示框
* @param success 成功的回调函数
*/
hideToast(success) {
try {
ThsToast.hide(success, err => {
console.log('err', err);
this.commUtilProvider.showToast('隐藏提示框失败');
})
}
catch (err) {
console.log(err);
}
};
说明:使用ts 进行开发时,需要在文件上变声明下declare const ThsToast;
import { Component, OnInit, Input } from '@angular/core';
declare const ThsToast;
@Component({
selector: 'app-explore-container',
templateUrl: './explore-container.component.html',
styleUrls: ['./explore-container.component.scss'],
})
常见错误
后续更新