PC浏览器中没有plus对象
import { Injectable } from '@angular/core';
declare var window: any;
@Injectable()
export class Plus {
plus: any;
constructor() {
**this.plus = window.plus == undefined ? null : window.plus;**
}
/**
* 消息提醒
* @param msg 消息
*/
toast(msg) {
**if (this.plus)** {
this.plus.nativeUI.toast(msg, { duration: "long" });
} else
{
alert(msg)
}
}
}
评论已关闭