ionic添加cordova插件-Toast 2016-12-22 app ionic **Toast** *这个插件可以显示一个像原生Toast(显示一小段文字提示)* ``` cordova plugin add cordova-plugin-x-toast ``` ***方法(Methods)*** **show(message, duration, position)** *增加一个或多个本地通知* 参数 类型 说明 message String 信息提示的一段文字 duration String 信息提示显示持续事件 长或短: ‘short’, ‘long’ position String 信息提示显示的位置顶部,中间,底部: ‘top’, ‘center’,’bottom’ - showShortTop(message) 显示顶部 - showShortCenter(message) 显示中间 - showShortBottom(message) 显示底部 - showLongTop(message) 显示顶部(长时间) - showLongCenter(message)显示中间(长时间) - showLongBottom(message)显示底部(长时间) **Examples** ``` module.controller('MyCtrl', function($cordovaToast) { $cordovaToast .show('ionic中文网', 'long', 'center') .then(function(success) { // success }, function (error) { // error }); $cordovaToast.showShortTop('ionic中文网').then(function(success) { // success }, function (error) { // error }); $cordovaToast.showLongBottom('ionic中文网').then(function(success) { // success }, function (error) { // error }); }) ```