12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- //常用对话框
- export const success = (title : string, duration = 1500, mask = false) => {
- return toast(title, duration, mask, 'success');
- }
- export const toast = function (title : string, duration : number, mask : boolean, icon : any) {
- return new Promise((resolve, reject) => {
- uni.showToast({
- title, duration, mask, icon,
- success: res => {
- setTimeout(function () {
- resolve(res);
- }, duration);
- },
- fail: err => {
- reject(err)
- }
- });
- });
- }
- //获取 错误提示
- export const error = (title : string) => {
- let duration = 2000;
- let mask = false;
- return new Promise((resolve, reject) => {
- uni.showToast({
- title, duration, mask,
- icon: "none",
- success: res => {
- setTimeout(function () {
- resolve(res);
- }, duration);
- },
- fail: err => {
- reject(err)
- }
- });
- });
- }
- //顶部信息
- export const tip = (title : string) => {
- uni.showToast({
- title,
- position: 'top',
- duration: 1500,
- mask: false,
- icon: 'none'
- });
- }
- export default {
- success, toast, error, tip,
- }
|